From: Eric Wong Date: Thu, 13 Mar 2025 20:35:04 +0000 (+0000) Subject: www: disable legacy encoded Message-IDs for non-v1 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=8f0891d40ac377f21cc64f11177f0f2cffd909f2;p=thirdparty%2Fpublic-inbox.git www: disable legacy encoded Message-IDs for non-v1 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. --- diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm index 05ec24162..50f182af1 100644 --- a/lib/PublicInbox/WWW.pm +++ b/lib/PublicInbox/WWW.pm @@ -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));