From 34d6aff1ca223521d8137f642a58db077ab70df0 Mon Sep 17 00:00:00 2001 From: "Eric Wong (Contractor, The Linux Foundation)" Date: Thu, 29 Mar 2018 09:57:56 +0000 Subject: www: cleanup expensive fallback for legacy URLs Back in the day, we compressed long Message-IDs to SHA-1 hexdigests for the URL. This now redirects to a 301 in the hopes we can remove these checks some day to reduce overhead. --- lib/PublicInbox/Inbox.pm | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'lib/PublicInbox/Inbox.pm') diff --git a/lib/PublicInbox/Inbox.pm b/lib/PublicInbox/Inbox.pm index 01aa500c..265360d9 100644 --- a/lib/PublicInbox/Inbox.pm +++ b/lib/PublicInbox/Inbox.pm @@ -293,13 +293,18 @@ sub path_check { git($self)->check('HEAD:'.$path); } +sub mid2num($$) { + my ($self, $mid) = @_; + my $mm = mm($self) or return; + $mm->num_for($mid); +} + sub smsg_by_mid ($$) { my ($self, $mid) = @_; my $srch = search($self) or return; # favor the Message-ID we used for the NNTP article number: - my $mm = mm($self) or return; - my $num = $mm->num_for($mid); - $srch->lookup_article($num); + my $num = mid2num($self, $mid); + defined $num ? $srch->lookup_article($num) : undef; } sub msg_by_mid ($$;$) { -- cgit v1.2.3-24-ge0c7