about summary refs log tree commit homepage
path: root/lib
diff options
context:
space:
mode:
authorEric Wong <e@80x24.org>2015-08-17 20:15:31 +0000
committerEric Wong <e@80x24.org>2015-08-17 20:15:31 +0000
commit9beef8313200e56ef37764a43fbdfe1f4bfb4294 (patch)
treeee83e4b5b0268313c104c9e318683d65a8851ee5 /lib
parentcc22505339e40fe45113ee39a4688070807eba58 (diff)
downloadpublic-inbox-9beef8313200e56ef37764a43fbdfe1f4bfb4294.tar.gz
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.
Diffstat (limited to 'lib')
-rw-r--r--lib/PublicInbox/View.pm6
1 files changed, 5 insertions, 1 deletions
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 {