about summary refs log tree commit homepage
path: root/t/v2writable.t
diff options
authorEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-18 09:13:10 +0000
committerEric Wong (Contractor, The Linux Foundation) <e@80x24.org>2018-04-18 09:14:14 +0000
commit69329215485cf2ab9d8cd1fa7faf65d8ec42dc0b (patch)
treedcf2a469711f8e61ce428f521d5e57d13a2e97c7 /t/v2writable.t
parent2a49233ab00a366251974824658a20bf68e519da (diff)
While hunting duplicates, I noticed a leading '-' in some
Message-IDs as a result of RFC4648 encoding.  While '-' seems
allowed by RFC5322 and URL-friendly (RFC4648), they are uncommon
and make using Message-IDs as arguments for command-line tools
more difficult.  So prefix them with a datestamp to at least
give readers some sense of the age.  And shorten the "localhost"
hostname to "z" to save space.
Diffstat (limited to 't/v2writable.t')
1 files changed, 3 insertions, 2 deletions
diff --git a/t/v2writable.t b/t/v2writable.t
index 85fb6a6d..d37fb06e 100644
--- a/t/v2writable.t
+++ b/t/v2writable.t
@@ -68,7 +68,7 @@ if ('ensure git configs are correct') {
                 [ $sec->header_obj->header_raw('Message-Id') ],
                 'no new Message-Id added');
-        my $sane_mid = qr/\A<[\w\-]+\@localhost>\z/;
+        my $sane_mid = qr/\A<[\w\-\.]+\@\w+>\z/;
         @warn = ();
         $mime->header_set('Message-Id', '<a-mid@b>');
@@ -82,7 +82,8 @@ if ('ensure git configs are correct') {
         @warn = ();
         $mime->header_set('Message-Id', '<a-mid@b>');
         $mime->body_set('this one needs a random mid');
-        my $gen = PublicInbox::Import::digest2mid(content_digest($mime));
+        my $hdr = $mime->header_obj;
+        my $gen = PublicInbox::Import::digest2mid(content_digest($mime), $hdr);
         unlike($gen, qr![\+/=]!, 'no URL-unfriendly chars in Message-Id');
         my $fake = PublicInbox::MIME->new($mime->as_string);
         $fake->header_set('Message-Id', "<$gen>");