From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: X-Spam-Status: No, score=-3.3 required=3.0 tests=ALL_TRUSTED,AWL,BAYES_00, RP_MATCHES_RCVD shortcircuit=no autolearn=unavailable version=3.3.2 X-Original-To: meta@public-inbox.org Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 9A18E1F81A for ; Mon, 17 Aug 2015 08:06:09 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH] view: always compress Message-IDs for anchors Date: Mon, 17 Aug 2015 08:06:09 +0000 Message-Id: <1439798769-2261-1-git-send-email-e@80x24.org> List-Id: Valid URLs do not make valid anchor ids. --- lib/PublicInbox/MID.pm | 4 ++-- lib/PublicInbox/View.pm | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/PublicInbox/MID.pm b/lib/PublicInbox/MID.pm index c75aa0e..2f0c09f 100644 --- a/lib/PublicInbox/MID.pm +++ b/lib/PublicInbox/MID.pm @@ -19,7 +19,7 @@ sub mid_clean { # this is idempotent sub mid_compressed { - my ($mid) = @_; + my ($mid, $force) = @_; # XXX dirty hack! FIXME! # Some HTTP servers (apache2 2.2.22-13+deb7u5 on my system) @@ -28,7 +28,7 @@ sub mid_compressed { # or what; will need to debug... return sha1_hex($mid) if (index($mid, '%') >= 0); - return $mid if (length($mid) <= MID_MAX); + return $mid if (!$force && length($mid) <= MID_MAX); sha1_hex($mid); } diff --git a/lib/PublicInbox/View.pm b/lib/PublicInbox/View.pm index 55e12f2..e7ca73d 100644 --- a/lib/PublicInbox/View.pm +++ b/lib/PublicInbox/View.pm @@ -477,7 +477,7 @@ sub linkify_refs { sub anchor_for { my ($msgid) = @_; - 'm' . mid_compressed(mid_clean($msgid)); + 'm' . mid_compressed(mid_clean($msgid), 1); } sub simple_dump { -- EW