fix(targets): handle MySQL DSN scheme case#2903
Merged
Merged
Conversation
Contributor
|
CLA requirements are satisfied for this pull request. |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes MySQL DSN parsing/redaction in rustfs-targets by making mysql:// scheme detection case-insensitive, so mixed-case schemes like MySQL:// no longer fall through to the “no scheme” parsing path.
Changes:
- Replaced ad hoc
strip_prefix("mysql://")/strip_prefix("MYSQL://")handling with a shared case-insensitivesplit_mysql_scheme()helper. - Updated DSN parsing to strip any ASCII-case variant of
mysql://. - Updated DSN redaction to preserve the original scheme casing while still redacting passwords, and added unit tests for mixed-case parsing/redaction.
houseme
approved these changes
May 10, 2026
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.
Related Issues
N/A
Summary of Changes
MySQL DSN parsing accepted only
mysql://andMYSQL://prefixes. That left mixed-case schemes such asMySQL://on the no-prefix path, causing the parser to treat the scheme as part of the username.This PR makes MySQL scheme detection case-insensitive while preserving the original prefix spelling for redacted output. It also adds focused unit coverage for mixed-case parsing and redaction.
Verification
cargo test -p rustfs-targets parse_dsn_with_mixed_case_mysql_prefix --libcargo test -p rustfs-targets redact_dsn_with_mixed_case_mysql_prefix --libcargo test -p rustfs-targets --libcargo fmt --all --checkgit diff --checkmake pre-commitImpact
Mixed-case MySQL DSN schemes now work consistently for target configuration and the recent MySQL connectivity probe. Existing lowercase, uppercase, and prefix-less DSNs keep the same behavior.
Additional Notes
N/A