From 9beef8313200e56ef37764a43fbdfe1f4bfb4294 Mon Sep 17 00:00:00 2001 From: Eric Wong Date: Mon, 17 Aug 2015 20:15:31 +0000 Subject: [PATCH] view: do not recompress already-compressed MID for anchors This is merely for display, so on the off chance somebody does send a 40-byte MID with nothing but hexadecimal characters, the worst that could happen is we repeat an anchor name in the rendered HTML. This has no impact on git archival or Xapian indexing. --- lib/PublicInbox/View.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index e7ca73dc..6fbc3660 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -477,7 +477,11 @@ sub linkify_refs { sub anchor_for { my ($msgid) = @_; - 'm' . mid_compressed(mid_clean($msgid), 1); + my $id = $msgid; + if ($id !~ /\A[a-f0-9]{40}\z/) { + $id = mid_compressed(mid_clean($id), 1); + } + 'm' . $id; } sub simple_dump { -- 2.50.0