about summary refs log tree commit homepage
path: root/lib/PublicInbox/RepoTree.pm
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2023-10-09 17:56:23 +0000
committerEric Wong <e@80x24.org>2023-10-09 18:41:36 +0000
commit5754faeb3fa1c9aaeff8922b449127cfbc86236d (patch)
tree09381346561d119ef30d6465baacc44f8a9d32dd /lib/PublicInbox/RepoTree.pm
parent02cd38ea042e01f343d52f8401cd56cf8e37dd9d (diff)
downloadpublic-inbox-5754faeb3fa1c9aaeff8922b449127cfbc86236d.tar.gz
We can't assume git output is UTF-8, and we'll always have
legacy data in git coderepos.  So attempt to display some
some garbled text rather than nothing at all if Perl croaks
on it.

sox commit c38987e8d20505621b8d872863afa7d233ed1096
(Added raw inverse-bit u-law and A-law support.  Updated *.txt files., 2001-12-13)
is an example of a commit which caused problems for me.
Diffstat (limited to 'lib/PublicInbox/RepoTree.pm')
-rw-r--r--lib/PublicInbox/RepoTree.pm4
1 files changed, 2 insertions, 2 deletions
diff --git a/lib/PublicInbox/RepoTree.pm b/lib/PublicInbox/RepoTree.pm
index 9c7b86b3..5c73531a 100644
--- a/lib/PublicInbox/RepoTree.pm
+++ b/lib/PublicInbox/RepoTree.pm
@@ -8,7 +8,7 @@ use PublicInbox::ViewDiff qw(uri_escape_path);
 use PublicInbox::WwwStatic qw(r);
 use PublicInbox::Qspawn;
 use PublicInbox::WwwStream qw(html_oneshot);
-use PublicInbox::Hval qw(ascii_html);
+use PublicInbox::Hval qw(ascii_html utf8_maybe);
 
 sub rd_404_log {
         my ($bref, $ctx) = @_;
@@ -26,7 +26,7 @@ sub rd_404_log {
                 $code = 404;
         } else {
                 my ($H, $h, $s_as) = split(/ /, $$bref, 3);
-                utf8::decode($s_as);
+                utf8_maybe($s_as);
                 my $x = uri_escape_path($ctx->{-path});
                 $s_as = ascii_html($s_as);
                 print $zfh <<EOM;