Repository navigation
fix(recipe): unescape escaped quotes and backslashes in quoted values - #396
Open
rahul05ranjan wants to merge 1 commit into
Open
rahul05ranjan wants to merge 1 commit into
rahul05ranjan wants to merge 1 commit into
Conversation
The SVS boundary scanners (withoutComments, closingBrace, closingSheet, valueSemicolon) all treat a backslash inside quotes as an escape, but parseValue only stripped the outer quote pair and returned the raw inner text, so \" sequences shipped through verbatim. Unescape the escaped delimiter quote and the escaped backslash when producing the value, matching what the scanners already accept. Fixes hypit-ai#392 Co-authored-by: rahul05ranjan <11793455+rahul05ranjan@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Quoted SVS Recipe values that escape an inner quote kept the backslashes in the parsed value, so
text: "He said \"hi\" twice";came out as the literalHe said \"hi\" twiceand any prompt/caption text built from the Recipe showed the stray backslashes end to end.The boundary scanners (
withoutComments,closingBrace,closingSheet,valueSemicolon) all already treat a backslash inside quotes as an escape — that is what lets an escaped quote,;or}sit inside a quoted value while the scanner still finds the right terminators — butparseValueonly stripped the outer quote pair and returned the raw inner text, so the escape form was accepted structurally and shipped through verbatim.This unescapes the escaped delimiter quote and the escaped backslash in
parseValuewhen producing the value for a quoted token, so the value layer finally agrees with the scanners. Scanner behavior is unchanged, and no new escape forms are introduced.Test:
packages/recipe/test/source-closure.test.tspins the issue example plus the escaped-backslash and single-quoted variants; it fails on unfixed main (He said \"hi\" twice) and passes with this change.Fixes #392