about summary refs log tree commit homepage
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-01-28 11:02:52 +0000
committerEric Wong <e@80x24.org>2023-01-28 18:52:32 +0000
commitf375ce494db8ce0e28676c89ed8b9d09a16de505 (patch)
tree971f833a7176074ae1bda84ec425265766fc1e34
parentf5a937081df8b698b62512684a993fe31990cea0 (diff)
downloadpublic-inbox-f375ce494db8ce0e28676c89ed8b9d09a16de505.tar.gz
It's safe to call utf8::decode on data where "\0" exists.
-rw-r--r--lib/PublicInbox/WwwCoderepo.pm3
1 files changed, 1 insertions, 2 deletions
diff --git a/lib/PublicInbox/WwwCoderepo.pm b/lib/PublicInbox/WwwCoderepo.pm
index 4d8713b4..8df6116a 100644
--- a/lib/PublicInbox/WwwCoderepo.pm
+++ b/lib/PublicInbox/WwwCoderepo.pm
@@ -124,7 +124,6 @@ EOM
         $last = pop(@r) if scalar(@r) > $ctx->{wcr}->{summary_branches};
         for (@r) {
                 my ($pfx, $oid, $ref, $s, $cd) = split(/\0/);
-                utf8::decode($_) for ($ref, $s);
                 chomp $cd;
                 my $align = length($ref) < 12 ? ' ' x (12 - length($ref)) : '';
                 print $zfh "$pfx <a\nhref=./$oid/s/>", ascii_html($ref),
@@ -148,7 +147,6 @@ EOM
         }
         for (@r) {
                 my (undef, $oid, $ref, $s, $cd) = split(/\0/);
-                utf8::decode($_) for ($ref, $s);
                 chomp $cd;
                 my $align = length($ref) < 12 ? ' ' x (12 - length($ref)) : '';
                 print $zfh "<a\nhref=./$oid/s/>", ascii_html($ref),
@@ -169,6 +167,7 @@ EOM
 sub capture_refs ($$) { # psgi_qx callback to capture git-for-each-ref + git-log
         my ($bref, $ctx) = @_;
         my $qsp_err = delete $ctx->{-qsp_err};
+        utf8::decode($$bref);
         $ctx->{-each_refs} = $$bref;
         summary_finish($ctx) if $ctx->{-readme};
 }