-
Notifications
You must be signed in to change notification settings - Fork 382
Fix parsing of double-quoted values with backslash continuations #373
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
base: main
Are you sure you want to change the base?
Conversation
When UnescapeValueDoubleQuotes is enabled, properly handle multiline values where backslash continuations appear after quotes within the value. Previously caused "key-value delimiter not found" errors.
|
Hi @unknwon, apologies for the ping. I know the project has been quiet, and I'm not requesting a review. I just wanted to ask whether this PR (or any other one) has any chance of being merged. It fixes an important issue for me, and I'm trying to decide whether I should wait or consider maintaining a fork. Thank you. |
|
Hey @felipecrs, thanks for the ping! I might be able to give a human-review some time this week, but can't commit on a timeline due to holiday travels! |
|
Thanks a lot, @unknwon! |
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.
Pull request overview
This PR fixes a parsing bug where multi-line double-quoted values with backslash line continuations would fail with "key-value delimiter not found" errors. The issue occurred when inner quotes appeared on lines ending with backslashes - the parser would incorrectly treat these inner quotes as closing quotes. The fix adds logic to check if a line ends with a backslash after finding a quote, and continues reading if so.
Key changes:
- Enhanced
readMultilinesfunction to detect backslash continuations after quotes - Added test coverage for git config-style multi-line quoted values with inner quotes
- Preserves existing behavior when
IgnoreContinuationoption is enabled
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| parser.go | Added backslash continuation detection in readMultilines to prevent premature quote closure when lines end with backslashes |
| ini_test.go | Added test case verifying multi-line double-quoted values with backslash continuations and inner quotes parse correctly |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
You can also share your feedback on Copilot code review for a chance to win a $100 gift card. Take the survey.
Describe the pull request
When
UnescapeValueDoubleQuotesis enabled, the parser now correctly handles multiline double-quoted values that contain backslash line continuations. Previously, it would incorrectly stop at intermediate quotes before a continuation, causingkey-value delimiter not founderrors.The fix checks if a line ends with a backslash after finding a closing quote, and continues reading if so, ensuring the actual closing quote is found.
Fixes parsing of values like:
Link to the issue: n/a
Checklist