Fix parsing of double-quoted values with backslash continuations#373
Fix parsing of double-quoted values with backslash continuations#373unknwon merged 4 commits intogo-ini:mainfrom
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.
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.
unknwon
left a comment
There was a problem hiding this comment.
Thanks for the PR! The code LGTM, but I need to push some commits to trigger/fix the CI 😂
|
Awesome, thanks a lot @unknwon! |
|
v1.67.1 released for this merge. |
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