Skip to content

Comments

driver: improve RE matching case#1107

Merged
lance6716 merged 5 commits intomasterfrom
lance6716/improve-re
Feb 25, 2026
Merged

driver: improve RE matching case#1107
lance6716 merged 5 commits intomasterfrom
lance6716/improve-re

Conversation

@lance6716
Copy link
Collaborator

as the comment in #1104 (comment)

Signed-off-by: lance6716 <lance6716@gmail.com>
Copilot AI review requested due to automatic review settings February 23, 2026 06:57
@lance6716
Copy link
Collaborator Author

@dveeden PTAL

Copy link
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 refines the DSN compatibility rewrite used by the driver package so that tcp(...) host rewriting only applies to the host portion (avoiding accidental rewrites in credentials/query), and expands test coverage for tricky DSN inputs.

Changes:

  • Tighten compatDSNre to be anchored and only rewrite the host tcp(...) segment.
  • Update the rewrite replacement to preserve the mysql:// prefix and optional userinfo.
  • Add DSN parsing tests for parentheses in query params and tcp(...) appearing in passwords.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
driver/driver.go Updates the compatibility regexp and replacement logic for tcp(...) DSN host rewriting.
driver/driver_test.go Adds new DSN parsing test cases to validate the improved matching behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@lance6716
Copy link
Collaborator Author

Addressed Copilot comments: switched replacement to `` and added a DSN parse test for tcp(...) host without credentials (e.g. `tcp(127.0.0.1:3310)/db`).

@lance6716
Copy link
Collaborator Author

@dveeden PTAL

@lance6716 lance6716 merged commit 4e46738 into master Feb 25, 2026
48 checks passed
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.

2 participants