* [PATCH] extmsg: try to fixup common errors
@ 2015-12-08 5:32 Eric Wong
0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2015-12-08 5:32 UTC (permalink / raw)
To: meta
Sometimes users (me :x) blindly append "raw" to a /t/ URL...
---
lib/PublicInbox/ExtMsg.pm | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/lib/PublicInbox/ExtMsg.pm b/lib/PublicInbox/ExtMsg.pm
index 5068047..82f4c63 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;
--
EW
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2015-12-08 5:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-08 5:32 [PATCH] extmsg: try to fixup common errors Eric Wong
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).