about summary refs log tree commit homepage
path: root/lib/PublicInbox/Import.pm
diff options
context:
space:
mode:
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-19 08:14:47 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-03-19 08:16:34 +0000
commit54f318f413d0fdf8a9d488a19c66b85697312ca0 (patch)
tree74fae5ee0c79e36962901500adf16b84763104bc /lib/PublicInbox/Import.pm
parent12c3eb5b2b0860292a32d5743ea0157996e9a4b9 (diff)
downloadpublic-inbox-54f318f413d0fdf8a9d488a19c66b85697312ca0.tar.gz
Hexdigests are too long and shorter Message-IDs are easier
to deal with.
Diffstat (limited to 'lib/PublicInbox/Import.pm')
-rw-r--r--lib/PublicInbox/Import.pm11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/PublicInbox/Import.pm b/lib/PublicInbox/Import.pm
index 4c007b61..77e74c13 100644
--- a/lib/PublicInbox/Import.pm
+++ b/lib/PublicInbox/Import.pm
@@ -401,7 +401,16 @@ sub atfork_child {
 
 sub digest2mid ($) {
         my ($dig) = @_;
-        $dig->clone->hexdigest . '@localhost';
+        my $b64 = $dig->clone->b64digest;
+        # Make our own URLs nicer:
+        # See "Base 64 Encoding with URL and Filename Safe Alphabet" in RFC4648
+        $b64 =~ tr!+/=!-_!d;
+
+        # We can make this more meaningful with a date prefix or other things,
+        # but this is only needed for crap that fails to generate a Message-ID
+        # or reuses one.  In other words, it's usually spammers who hit this
+        # so they don't deserve nice Message-IDs :P
+        $b64 . '@localhost';
 }
 
 1;