Repository navigation
fix(web/blog): unescape quoted announcement values in the Discussion announcer - #4604
Merged
Merged
Conversation
…announcer
extractAnnouncement() stripped the outer quotes from each announcement
scalar but left YAML escapes in place, so a single-quoted title with ''
produced a Discussion title with a doubled apostrophe, while the blog page
showed it correctly. Double-quoted values kept \" and \\ the same way.
A small unquoteScalar() helper now decides the quote style once, strips
one layer, and unescapes for that style ('' to ' in single quotes; \" and
\\ in double quotes). It also stops a single-quoted value whose content is
wrapped in double quotes from being stripped twice.
Fixes #4512
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Peter Amiri <peter@alurium.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
extractAnnouncement()inweb/scripts/blog-announce-discussion.mjsstripped the outer quotes from eachannouncement:value but left YAML escapes in place. Soproduced the Discussion title
…doesn''t touch, while the blog page showeddoesn't. Double-quoted values kept\"and\\the same way.A small
unquoteScalar()helper now:''into'in single quotes;\"and\\in double quotes, in one left-to-right pass.It also stops
'"x"'being stripped twice, which the old chained replaces did. Other double-quoted escapes (\n,\t,\u…) stay literal, as before. It adds no new dependencies, andextractSlug()is unchanged.Fixes #4512
Testing
node --test web/scripts/blog-announce-discussion.test.mjs:'', a double-quoted\"/\\, strip-only-once, and an unquoted value.🤖 Generated with Claude Code