]> Sergey Matveev's repositories - public-inbox.git/blobdiff - scripts/ssoma-replay
treewide: run update-copyrights from gnulib for 2019
[public-inbox.git] / scripts / ssoma-replay
index 91c121dd2f0e3eda8b1232d8c8cdfbab325ec8d7..46b15d7eb185d26d98304424fc33567dcdda2e34 100755 (executable)
@@ -1,5 +1,5 @@
 #!/usr/bin/perl -w
-# Copyright (C) 2015-2016 all contributors <meta@public-inbox.org>
+# Copyright (C) 2015-2020 all contributors <meta@public-inbox.org>
 # License: AGPL-3.0+ <https://www.gnu.org/licenses/agpl-3.0.txt>
 #
 # A work-in-progress, but one day I hope this script is no longer
@@ -45,7 +45,9 @@ my $body = $msg->body;
 my $list_id = $header_obj->header('List-Id');
 my ($archive_url, $user, $domain);
 if (defined $list_id) {
-       ($user, $domain) = ($list_id =~ /<(.+)\@(.+)>/g);
+       # due to a bug in old versions of public-inbox, <user@domain> was used
+       # as the list-Id instead of <user.domain> as recommended in RFC2919
+       ($user, $domain) = ($list_id =~ /<([^\.@]+)[\.@](.+)>/g);
 
        if (defined $domain) {
                $archive_url = "https://$domain/$user/";
@@ -53,7 +55,8 @@ if (defined $list_id) {
                if ($mid =~ /\A<(.+)>\z/) {
                        $mid = $1;
                }
-               $mid = uri_escape_utf8($mid);
+               $mid = uri_escape_utf8($mid,
+                               '^A-Za-z0-9\-\._~!\$\&\';\(\)\*\+,;=:@');
                $header_obj->header_set('List-Archive', "<$archive_url>");
 
                foreach my $h (qw(Help Unsubscribe Subscribe Owner)) {