Skip to content

Commit b718c0e

Browse files
authored
Merge pull request #30 from erikcc02/master
fix: apply the email mask correctly
2 parents 62f363c + e24165a commit b718c0e

File tree

3 files changed

+3
-3
lines changed

3 files changed

+3
-3
lines changed

email.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func (m *EmailMasker) Marshal(s string, i string) string {
2424
addr := tmp[0]
2525
domain := tmp[1]
2626

27-
addr = overlay(addr, strLoop(s, 4), 3, 7)
27+
addr = overlay(addr, strLoop(s, 4), 3, len(addr))
2828

2929
return addr + "@" + domain
3030
}

email_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func TestEmailMasker_Marshal(t *testing.T) {
2727
s: "*",
2828
i: "ggw.chang@gmail.com",
2929
},
30-
want: "ggw****ng@gmail.com",
30+
want: "ggw****@gmail.com",
3131
},
3232
{
3333
name: "Address Less Than 3",

masker_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -345,7 +345,7 @@ func TestMaskerMarshaler_Struct(t *testing.T) {
345345
Email string `mask:"email"`
346346
}{
347347
Name: "J**n D**e",
348-
Email: "ggw****ng@gmail.com",
348+
Email: "ggw****@gmail.com",
349349
},
350350
},
351351
},

0 commit comments

Comments
 (0)