From: Eric Wong Date: Mon, 17 Aug 2015 20:15:31 +0000 (+0000) Subject: view: do not recompress already-compressed MID for anchors X-Git-Tag: v1.0.0~1050 X-Git-Url: http://www.git.stargrave.org/?a=commitdiff_plain;h=9beef8313200e56ef37764a43fbdfe1f4bfb4294;p=public-inbox.git 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. --- 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 {