unofficial mirror of meta@public-inbox.org
 help / color / mirror / Atom feed
* [PATCH] hval: only perform one substitution when obfuscating
@ 2017-06-29  0:13 Eric Wong
  0 siblings, 0 replies; only message in thread
From: Eric Wong @ 2017-06-29  0:13 UTC (permalink / raw)
  To: meta

Only one substitution character is necessary when obfuscating
email addresses.
---
 lib/PublicInbox/Hval.pm | 2 +-
 t/hval.t                | 2 ++
 2 files changed, 3 insertions(+), 1 deletion(-)

diff --git a/lib/PublicInbox/Hval.pm b/lib/PublicInbox/Hval.pm
index 8005088..8d36fc2 100644
--- a/lib/PublicInbox/Hval.pm
+++ b/lib/PublicInbox/Hval.pm
@@ -100,7 +100,7 @@ sub obfuscate_addrs ($$) {
 		if ($addrs->{$addr} || ((defined $re && $domain =~ $re))) {
 			$addr;
 		} else {
-			$addr =~ s!([^\.]+)\.!$1•!g;
+			$addr =~ s!([^\.]+)\.!$1•!;
 			$addr
 		}
 		/sge;
diff --git a/t/hval.t b/t/hval.t
index dcbd838..a371266 100644
--- a/t/hval.t
+++ b/t/hval.t
@@ -17,6 +17,7 @@ hello@example.comm
 hello@example.com
 meta@public-inbox.org
 test@public-inbox.org
+test@a.b.c.org
 EOF
 
 PublicInbox::Hval::obfuscate_addrs($ibx, $html);
@@ -26,6 +27,7 @@ hello@example•comm
 hello@example.com
 meta@public-inbox.org
 test@public-inbox•org
+test@a•b.c.org
 EOF
 
 is($html, $exp, 'only obfuscated relevant addresses');
-- 
EW


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2017-06-29  0:13 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-06-29  0:13 [PATCH] hval: only perform one substitution when obfuscating Eric Wong

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).