Thanks to visit codestin.com
Credit goes to github.com

Skip to content

caddyhttp: fix randString sameCase dictionary to match its docs - #7972

Open
mohammed90 wants to merge 2 commits into
masterfrom
fix-rand-string-same-case-dict
Open

caddyhttp: fix randString sameCase dictionary to match its docs#7972
mohammed90 wants to merge 2 commits into
masterfrom
fix-rand-string-same-case-dict

Conversation

@mohammed90

Copy link
Copy Markdown
Member

The doc comment says randString excludes confusing characters like I, l, 1, 0, O. When sameCase is true, uppercase letters and the characters l and o should be excluded. But the sameCase dictionary still contained '0'. Drop it.

Assistance Disclosure

Test was generated by copilot/Claude 4.7; fixed by the same.

Related to #7227

The doc comment says randString excludes confusing characters like
I, l, 1, 0, O. When sameCase is true, uppercase letters and the
characters l and o should be excluded. But the sameCase dictionary
still contained '0'. Drop it.

Signed-off-by: Mohammed Al Sahaf <[email protected]>
@mohammed90 mohammed90 added the bug 🐞 Something isn't working label Aug 30, 2026
@steadytao steadytao added this to the v2.11.5 milestone Sep 2, 2026
dict := []byte("abcdefghijkmnopqrstuvwxyzABCDEFGHJKLMNPQRTUVWXY23456789")
if sameCase {
dict = []byte("abcdefghijkmnpqrstuvwxyz0123456789")
dict = []byte("abcdefghijkmnpqrstuvwxyz123456789")

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documented ambiguous-character exclusions include both 0 and 1. This removes 0 but still emits 1 while the mixed-case dictionary correctly starts at 2.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🐞 Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants