about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-12-08 05:31:23 +0000
committerEric Wong <e@80x24.org>2015-12-08 05:31:23 +0000
commit84130495f67b9d50e663f64c8e11293614bf0a24 (patch)
tree729fae6f853e0f8da1e4b37e443e1fa4ed4c9a7d /lib
parent1481168a6c76029e1d75d226c0be7bf68136f0e8 (diff)
downloadpublic-inbox-84130495f67b9d50e663f64c8e11293614bf0a24.tar.gz
Sometimes users (me :x) blindly append "raw" to a /t/ URL...
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/ExtMsg.pm9
1 files changed, 8 insertions, 1 deletions
diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm
index 50680471..82f4c63d 100644
--- a/lib/PublicInbox/ExtMsg.pm
+++ b/lib/PublicInbox/ExtMsg.pm
@@ -96,6 +96,8 @@ sub ext_msg {
         eval { require PublicInbox::Msgmap };
         my $have_mm = $@ ? 0 : 1;
         if ($have_mm) {
+                my $tmp_mid = $mid;
+again:
                 my $cgi = $ctx->{cgi};
                 my $url = ref($cgi) eq 'CGI' ? $cgi->url(-base) . '/'
                                         : $cgi->base->as_string;
@@ -106,13 +108,18 @@ sub ext_msg {
                         my $mm = eval { PublicInbox::Msgmap->new($git_dir) };
 
                         $mm or next;
-                        if (my $res = $mm->mid_prefixes($mid)) {
+                        if (my $res = $mm->mid_prefixes($tmp_mid)) {
                                 $n_partial += scalar(@$res);
                                 $pfx->{res} = $res;
                                 push @partial, $pfx;
                         }
                 }
+                # fixup common errors:
+                if (!$n_partial && $tmp_mid =~ s,/[tTf],,) {
+                        goto again;
+                }
         }
+
         my $code = 404;
         my $h = PublicInbox::Hval->new_msgid($mid, 1);
         my $href = $h->as_href;