caddyhttp: fix randString sameCase dictionary to match its docs
The doc comment says randString excludes confusing characters like I, l, 1, 0, O. When sameCase is true, uppercase letters are excluded, and l and o should also be excluded. But the dictionary used when sameCase was true still contained '0'. Drop it, and update the test to match the actual documented exclusions. Signed-off-by: Mohammed Al Sahaf <msaa1990@gmail.com>add-tests
parent
efbb7bc8b8
commit
aea7b9bdf0
|
|
@ -96,7 +96,7 @@ func randString(n int, sameCase bool) string {
|
|||
}
|
||||
dict := []byte("abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY23456789")
|
||||
if sameCase {
|
||||
dict = []byte("abcdefghijkmnpqrstuvwxyz0123456789")
|
||||
dict = []byte("abcdefghijkmnpqrstuvwxyz123456789")
|
||||
}
|
||||
b := make([]byte, n)
|
||||
for i := range b {
|
||||
|
|
|
|||
|
|
@ -164,7 +164,7 @@ func TestRandString_NoConfusingChars(t *testing.T) {
|
|||
{
|
||||
name: "same case excludes l,0",
|
||||
sameCase: true,
|
||||
excluded: []rune{'l', 'o'},
|
||||
excluded: []rune{'l', '0'},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue