]> Sergey Matveev's repositories - public-inbox.git/commitdiff
mid: rename MID_MAX to ID_MAX
authorEric Wong <e@80x24.org>
Tue, 15 Sep 2020 19:51:36 +0000 (19:51 +0000)
committerEric Wong <e@80x24.org>
Wed, 16 Sep 2020 04:06:10 +0000 (04:06 +0000)
It's only used for HTML anchors which we will need indefinitely.

lib/PublicInbox/MID.pm

index e9a3b0c094e52b3fce1d330374d03b6bd7520235..369bb034c8dd9d5c03ce4beb2e35d1c5fc632a9c 100644 (file)
@@ -12,7 +12,7 @@ use URI::Escape qw(uri_escape_utf8);
 use Digest::SHA qw/sha1_hex/;
 require PublicInbox::Address;
 use constant {
 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')
 };
 
        MAX_MID_SIZE => 244, # max term size (Xapian limitation) - length('Q')
 };
 
@@ -32,7 +32,7 @@ sub mid_clean {
 sub id_compress {
        my ($id, $force) = @_;
 
 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);
        }
                utf8::encode($id);
                return sha1_hex($id);
        }