Some messages will be misimported due to an old bug,
clean them up and ensure we do not propagate the mistake.
Followup-to: a0c07cba0e5d ("mda: drop leading "From " lines again")
sub msg_by_path ($$;$) {
my ($self, $path, $ref) = @_;
# TODO: allow other refs:
- git($self)->cat_file('HEAD:'.$path, $ref);
+ my $str = git($self)->cat_file('HEAD:'.$path, $ref);
+ $$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
+ $str;
}
sub msg_by_mid ($$;$) {
my ($git, $blob, $sizeref) = @_;
my $mime = eval {
my $str = $git->cat_file($blob, $sizeref);
+ # fixup bugs from import:
+ $$str =~ s/\A[\r\n]*From [^\r\n]*\r?\n//s;
Email::MIME->new($str);
};
$@ ? undef : $mime;