-
Notifications
You must be signed in to change notification settings - Fork 85
Add support for double-quoted values in ADO connection strings #283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Co-authored-by: shueybubbles <[email protected]>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #283 +/- ##
==========================================
+ Coverage 75.27% 75.29% +0.01%
==========================================
Files 33 33
Lines 6500 6512 +12
==========================================
+ Hits 4893 4903 +10
- Misses 1324 1325 +1
- Partials 283 284 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
msdsn/conn_str.go
Outdated
if char == '"' { | ||
if inQuotes && i+1 < len(dsn) && dsn[i+1] == '"' { | ||
// Double quote escape sequence - add both quotes to current part | ||
current.WriteByte(char) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
shouldn't this code use WriteRune instead of WriteByte?
Go strings are UTF-8 encoded and may have multi-byte characters. Include a test with multi-byte UTF8 character values. @copilot #Closed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed in commit 4794128. Changed the function to properly handle UTF-8 runes by using WriteRune instead of WriteByte and iterating over runes instead of bytes. Added comprehensive test cases with multibyte UTF-8 characters including Cyrillic, Chinese, emoji, and accented characters.
@copilot Add test cases with multibyte UTF8 characters in the values. I believe the new code should use WriteRune instead of WriteByte #Closed |
Replace WriteByte with WriteRune in splitAdoConnectionStringParts to properly handle multibyte UTF-8 characters. Add comprehensive test cases with Cyrillic, Chinese, emoji, and accented characters in quoted connection string values. Co-authored-by: shueybubbles <[email protected]>
Added in commit 4794128. The code now uses WriteRune instead of WriteByte and includes test cases with multibyte UTF-8 characters: Cyrillic (пароль), Chinese (服务器, 密码), emoji (🔐, 🗝️), and accented characters (café, naïve, résumé). All tests are passing. #Resolved |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Update version.go to set the version to 1.9.3
- Update changelog.md to mention this fix in 1.9.3
- Update the README.md to document how to use values with semicolons
|
Co-authored-by: shueybubbles <[email protected]>
All three updates have been completed in commit 1fb0c2c:
The documentation now clearly shows how to use double-quoted values in ADO connection strings, including examples with semicolons and escaped quotes. All tests are passing. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR implements proper parsing of ADO.NET connection strings with support for double-quoted values that can contain special characters like semicolons.
Problem
ADO connection strings with passwords containing semicolons were incorrectly parsed because the parser would split on all semicolons, truncating values at the first semicolon encountered:
Solution
Added support for double-quoted values in ADO connection strings, following ADO.NET connection string conventions:
""
)Implementation Details
splitConnectionString
function to use a newsplitAdoConnectionStringParts
helper""
sequenceUsage Examples
Version and Documentation Updates
Fixes #282.
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.