Skip to content

fix(targets): handle MySQL DSN scheme case#2903

Merged
houseme merged 2 commits into
mainfrom
codex/test-mysql-probe-coverage
May 10, 2026
Merged

fix(targets): handle MySQL DSN scheme case#2903
houseme merged 2 commits into
mainfrom
codex/test-mysql-probe-coverage

Conversation

@overtrue
Copy link
Copy Markdown
Collaborator

Related Issues

N/A

Summary of Changes

MySQL DSN parsing accepted only mysql:// and MYSQL:// prefixes. That left mixed-case schemes such as MySQL:// 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 --lib
  • cargo test -p rustfs-targets redact_dsn_with_mixed_case_mysql_prefix --lib
  • cargo test -p rustfs-targets --lib
  • cargo fmt --all --check
  • git diff --check
  • make pre-commit

Impact

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

Copilot AI review requested due to automatic review settings May 10, 2026 13:24
@github-actions
Copy link
Copy Markdown
Contributor

CLA requirements are satisfied for this pull request.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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-insensitive split_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.

@overtrue overtrue marked this pull request as ready for review May 10, 2026 13:38
@houseme houseme enabled auto-merge May 10, 2026 14:11
@houseme houseme added this pull request to the merge queue May 10, 2026
Merged via the queue into main with commit 0375dd3 May 10, 2026
8 checks passed
@houseme houseme deleted the codex/test-mysql-probe-coverage branch May 10, 2026 14:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants