user/dev discussion of public-inbox itself
 help / color / mirror / code / Atom feed
* [PATCH] www: disable legacy encoded Message-IDs for non-v1
@ 2025-03-13 20:35 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2025-03-13 20:35 UTC (permalink / raw)
  To: meta

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 | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/lib/PublicInbox/WWW.pm b/lib/PublicInbox/WWW.pm
index 05ec2416..50f182af 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));

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2025-03-13 20:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-03-13 20:35 [PATCH] www: disable legacy encoded Message-IDs for non-v1 Eric Wong

Code repositories for project(s) associated with this public inbox

	https://80x24.org/public-inbox.git

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).