use v5.12;
use File::Temp 0.19 (); # 0.19 for ->newdir
use PublicInbox::ContentHash qw(content_digest);
-use PublicInbox::ContentDigestDbg;
-use Data::Dumper ();
use PublicInbox::MsgIter qw(msg_part_text);
use PublicInbox::ViewDiff qw(flush_diff);
use PublicInbox::GitAsyncCat;
my $ct = $part->content_type || 'text/plain';
my ($s, $err) = msg_part_text($part, $ct);
my $sfx = defined($s) ? 'txt' : 'bin';
- open my $fh, '>', "$self->{curdir}/$idx.$sfx" or die "open: $!";
- print $fh ($s // $part->body) or die "print $!";
+ $s //= $part->body;
+ $s =~ s/\r+\n/\n/sg;
+ open my $fh, '>:utf8', "$self->{curdir}/$idx.$sfx" or die "open: $!";
+ print $fh $s or die "print $!";
close $fh or die "close $!";
}
$eml->each_part(\&write_part, $self);
return if $self->{ctx}; # don't need content_digest noise in WWW UI
+ require PublicInbox::ContentDigestDbg;
# XXX is this even useful? perhaps hide it behind a CLI switch
open my $fh, '>', "$dir/content_digest" or die "open: $!";
my $dig = PublicInbox::ContentDigestDbg->new($fh);
- local $Data::Dumper::Useqq = 1;
- local $Data::Dumper::Terse = 1;
content_digest($eml, $dig);
print $fh "\n", $dig->hexdigest, "\n" or die "print $!";
close $fh or die "close: $!";
sub emit_msg_diff {
my ($bref, $self) = @_; # bref is `git diff' output
# will be escaped to `•' in HTML
+ utf8::decode($$bref);
$self->{ctx}->{ibx}->{obfuscate} and
obfuscate_addrs($self->{ctx}->{ibx}, $$bref, "\x{2022}");
- $$bref =~ s/\r+\n/\n/sg;
print { $self->{ctx}->{zfh} } '</pre><hr><pre>' if $self->{nr} > 1;
flush_diff($self->{ctx}, $bref);
next_smsg($self);