Repository navigation
Encode slashes in DSN usernames - #2446
Merged
Merged
Conversation
Contributor
|
Hi! Great! Thanks! |
Contributor
|
Released in https://github.com/dbcli/mycli/releases/tag/v2.31.1 ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
A username such as
team/aliceproducesmysql://team/alice@db.example.com:3307/prodwhen showing or saving a DSN. Reusing that alias treatsteamas the hostname and loses the original username, port, and database.Percent-encode
/in the username so the DSN becomesmysql://team%2Falice@db.example.com:3307/prod. The regression saves and reloads an alias, then checks the connection arguments through the CLI dispatcher. It covers TCP and Unix sockets, both alias environment-expansion modes, and usernames containing/, literal%2F,@, and Unicode.Validation on Python 3.14.3:
ruff check,ruff format --check, andmypy --install-types --non-interactive .passed.No live MySQL server or full tox/behave integration run was used. The tests exercise real DSN generation and configuration persistence, with a dummy connection target.
AI assistance: Codex assisted with the fix, tests, and this description. The checks listed above were run locally by Codex.
Checklist
I added this contribution to the
changelog.mdfile.I added my name to the
mycli/AUTHORS.txtfile (or it's already there).To lint, check formatting, and check types, I ran:
env -u PYTHONPATH uv run --no-sync -- ruff check env -u PYTHONPATH uv run --no-sync -- ruff format --check env -u PYTHONPATH uv run --no-sync -- mypy --install-types --non-interactive .