From aea7b9bdf05a8a19d14f71a12364db703924f18c Mon Sep 17 00:00:00 2001 From: Mohammed Al Sahaf Date: Sun, 30 Aug 2026 18:23:09 +0300 Subject: [PATCH] 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 --- modules/caddyhttp/errors.go | 2 +- modules/caddyhttp/errors_utils_test.go | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/modules/caddyhttp/errors.go b/modules/caddyhttp/errors.go index d27df6626..45eea1bd4 100644 --- a/modules/caddyhttp/errors.go +++ b/modules/caddyhttp/errors.go @@ -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 { diff --git a/modules/caddyhttp/errors_utils_test.go b/modules/caddyhttp/errors_utils_test.go index 7e1fe19fd..142906a4f 100644 --- a/modules/caddyhttp/errors_utils_test.go +++ b/modules/caddyhttp/errors_utils_test.go @@ -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'}, }, }