fix(sources): use shared yamlEscape in buildFrontmatter#34
Conversation
buildFrontmatter had its own inline YAML quoting that only checked for 4 special characters (: " [ ]). Titles containing #, ', \, newlines, or other YAML metacharacters were written unquoted or with incomplete escaping. Replaced with yamlEscape() which already handles all of these.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (2)
📝 WalkthroughWalkthroughA refactor that centralizes YAML escaping logic by introducing a Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~10 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
📝 Coding Plan
Comment |
formatRelease was hand-rolling YAML escaping for the name field (only escaping double quotes) and emitting tag/version fields unescaped. Release names with backslashes, newlines, or colons would produce corrupt frontmatter. Same class of bug fixed in buildFrontmatter (#34).
Description
buildFrontmatteringithub-common.tshad its own inline YAML quoting logic that only triggered on 4 characters (: " [ ]). Issue and discussion titles containing#,',\, newlines, or other YAML metacharacters went through unquoted or with incomplete escaping - backslashes weren't escaped before quotes, sofoo\nbarwould be misread as a newline by any YAML parser consuming the frontmatter.Replaced the inline logic with
yamlEscape()fromcore/yaml.tswhich already handles all 18+ special characters correctly. One import, one line changed.Linked Issues
Additional context
8 new unit tests for
buildFrontmattercovering colons, hash signs, backslashes, newlines, single quotes, double quotes, simple values, and undefined skipping.Summary by CodeRabbit
Bug Fixes
Tests