From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-Status: No, score=-4.0 required=3.0 tests=ALL_TRUSTED,BAYES_00 shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from localhost (dcvr.yhbt.net [127.0.0.1]) by dcvr.yhbt.net (Postfix) with ESMTP id 5887C1F66F for ; Tue, 15 Sep 2020 19:51:37 +0000 (UTC) From: Eric Wong To: meta@public-inbox.org Subject: [PATCH 1/2] mid: rename MID_MAX to ID_MAX Date: Tue, 15 Sep 2020 19:51:36 +0000 Message-Id: <20200915195137.13476-2-e@80x24.org> In-Reply-To: <20200915195137.13476-1-e@80x24.org> References: <20200915195137.13476-1-e@80x24.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit List-Id: It's only used for HTML anchors which we will need indefinitely. --- lib/PublicInbox/MID.pm | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/PublicInbox/MID.pm b/lib/PublicInbox/MID.pm index e9a3b0c0..369bb034 100644 --- a/lib/PublicInbox/MID.pm +++ b/lib/PublicInbox/MID.pm @@ -12,7 +12,7 @@ use URI::Escape qw(uri_escape_utf8); use Digest::SHA qw/sha1_hex/; require PublicInbox::Address; use constant { - MID_MAX => 40, # SHA-1 hex length # TODO: get rid of this + ID_MAX => 40, # SHA-1 hex length for HTML id anchors MAX_MID_SIZE => 244, # max term size (Xapian limitation) - length('Q') }; @@ -32,7 +32,7 @@ sub mid_clean { sub id_compress { my ($id, $force) = @_; - if ($force || $id =~ /[^a-zA-Z0-9_\-]/ || length($id) > MID_MAX) { + if ($force || $id =~ /[^a-zA-Z0-9_\-]/ || length($id) > ID_MAX) { utf8::encode($id); return sha1_hex($id); }