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.
sub anchor_for {
my ($msgid) = @_;
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;