Skip to content

Commit

Permalink
small fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Skandalik committed Oct 10, 2024
1 parent 55b44c8 commit 18298b9
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
8 changes: 5 additions & 3 deletions gdpr/protect_device_id.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,14 @@ func ProtectDeviceID(val string) string {
l := len(r)

// If someone passes string with less than 2 characters, we don't protect it.
c := 2
if l < 2 {
return val
c = l
}

r[l-1] = hiddenRune
r[l-2] = hiddenRune
for i := 1; i <= c; i++ {
r[l-i] = hiddenRune
}

return string(r)
}
2 changes: 1 addition & 1 deletion gdpr/protect_device_id_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ func Test_ProtectDeviceID(t *testing.T) {
{
name: "string with less than 2 chars",
value: "1",
want: "1",
want: "*",
},
}
for _, tt := range tests {
Expand Down

0 comments on commit 18298b9

Please sign in to comment.