diff options
-rw-r--r-- | lib/PublicInbox/Hval.pm | 8 | ||||
-rw-r--r-- | t/hval.t | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm index 00a923ea..0e199025 100644 --- a/lib/PublicInbox/Hval.pm +++ b/lib/PublicInbox/Hval.pm @@ -95,13 +95,13 @@ sub obfuscate_addrs ($$) { my $ibx = $_[0]; my $re = $ibx->{-no_obfuscate_re}; # regex of domains my $addrs = $ibx->{-no_obfuscate}; # { adddress => 1 } - $_[1] =~ s/([\w\.\+=\-]+\@([\w\-]+\.[\w\.\-]+))/ - my ($addr, $domain) = ($1, $2); + $_[1] =~ s/(([\w\.\+=\-]+)\@([\w\-]+\.[\w\.\-]+))/ + my ($addr, $user, $domain) = ($1, $2, $3); if ($addrs->{$addr} || ((defined $re && $domain =~ $re))) { $addr; } else { - $addr =~ s!([^\.]+)\.!$1•!; - $addr + $domain =~ s!([^\.]+)\.!$1•!; + $user . '@' . $domain } /sge; } @@ -18,6 +18,7 @@ hello@example.com meta@public-inbox.org test@public-inbox.org test@a.b.c.org +te.st@example.org EOF PublicInbox::Hval::obfuscate_addrs($ibx, $html); @@ -28,6 +29,7 @@ hello@example.com meta@public-inbox.org test@public-inbox•org test@a•b.c.org +te.st@example•org EOF is($html, $exp, 'only obfuscated relevant addresses'); |