]> git.ipfire.org Git - thirdparty/public-inbox.git/commitdiff
www: disable legacy encoded Message-IDs for non-v1
authorEric Wong <e@80x24.org>
Thu, 13 Mar 2025 20:35:04 +0000 (20:35 +0000)
committerEric Wong <e@80x24.org>
Tue, 18 Mar 2025 07:04:41 +0000 (07:04 +0000)
For a while in the very early days of the v1 format, we
supported SHA-1 checksums of the Message-ID in the URL.  This
never affected v2 inboxes nor extindex, and those URLs would've
been broken if run through public-inbox-convert, anyways.

lib/PublicInbox/WWW.pm

index 05ec241629a6b19e7f95ecb9079df38dd0cfc9d9..50f182af1d1f17426a5aae8b05a0299ff32e17c6 100644 (file)
@@ -253,10 +253,11 @@ sub invalid_inbox_mid {
 
        my $mid = $ctx->{mid} = uri_unescape($mid_ue);
        my $ibx = $ctx->{ibx};
-       if ($mid =~ m!\A([a-f0-9]{2})([a-f0-9]{38})\z!) {
+       if ($ibx->can('version') && $ibx->version == 1 &&
+                       $mid =~ m!\A([a-f0-9]{2})([a-f0-9]{38})\z!) {
                my ($x2, $x38) = ($1, $2);
                # this is horrifically wasteful for legacy URLs:
-               my $str = $ctx->{ibx}->msg_by_path("$x2/$x38") or return;
+               my $str = $ibx->msg_by_path("$x2/$x38") or return;
                my $s = PublicInbox::Eml->new($str);
                $mid = PublicInbox::MID::mid_clean($s->header_raw('Message-ID'));
                return r301($ctx, $inbox, mid_escape($mid));