]> Sergey Matveev's repositories - public-inbox.git/blobdiff - lib/PublicInbox/Hval.pm
reply: follow obfuscation rules for HTML in sh args
[public-inbox.git] / lib / PublicInbox / Hval.pm
index 0e199025adcec36d72d55e139900e1bf03f26edc..d65ab3217c915a18db892e226a87af7594a2fe53 100644 (file)
@@ -91,8 +91,9 @@ sub prurl {
 # ․ · and ͺ were also candidates:
 #   https://public-inbox.org/meta/20170615015250.GA6484@starla/
 # However, • was chosen to make copy+paste errors more obvious
-sub obfuscate_addrs ($$) {
+sub obfuscate_addrs ($$;$) {
        my $ibx = $_[0];
+       my $repl = $_[2] || '•';
        my $re = $ibx->{-no_obfuscate_re}; # regex of domains
        my $addrs = $ibx->{-no_obfuscate}; # { adddress => 1 }
        $_[1] =~ s/(([\w\.\+=\-]+)\@([\w\-]+\.[\w\.\-]+))/
@@ -100,7 +101,7 @@ sub obfuscate_addrs ($$) {
                if ($addrs->{$addr} || ((defined $re && $domain =~ $re))) {
                        $addr;
                } else {
-                       $domain =~ s!([^\.]+)\.!$1•!;
+                       $domain =~ s!([^\.]+)\.!$1$repl!;
                        $user . '@' . $domain
                }
                /sge;