fix: escape single quotes and backslashes in IR string output#90
Open
AugustHagedal wants to merge 1 commit intoSnapchat:mainfrom
Open
fix: escape single quotes and backslashes in IR string output#90AugustHagedal wants to merge 1 commit intoSnapchat:mainfrom
AugustHagedal wants to merge 1 commit intoSnapchat:mainfrom
Conversation
Strings containing single quotes or backslashes would break the IR parser because appendQuotedString emitted them unescaped inside single-quote delimiters. - Add escapeIRString() helper that escapes \, ', \n, \r, \t - Apply it in appendQuotedString() (removes the long-standing TODO) - Fix the LiteralString IR case to route through appendQuotedString instead of its own inline template literal - Add two regression tests (single-quote and backslash in string literals) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
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.
Summary
'or\in their value broke the IR parser becauseappendQuotedStringemitted them unescaped inside single-quote delimiters (a TODO comment had flagged this since the file was written)LiteralStringIR case had its own inline template that bypassedappendQuotedStringentirely, so it also emitted unescaped stringsChanges
escapeIRString()helper inIRtoString.tsthat escapes\,',\n,\r, and\tappendQuotedString(), removing the long-standingTODO(simon): Escape quotescommentLiteralStringcase to route throughappendQuotedStringinstead of its own inline template literalTest plan
escapes single quotes in string literals— verifiesstorestring 'it\'s a test'escapes backslashes in string literals— verifiesstorestring 'C:\\Users\\file'🤖 Generated with Claude Code