Skip to content

fix: escape special characters in export formats#286

Open
nimish-ks wants to merge 2 commits intomainfrom
fix/export-escaping
Open

fix: escape special characters in export formats#286
nimish-ks wants to merge 2 commits intomainfrom
fix/export-escaping

Conversation

@nimish-ks
Copy link
Copy Markdown
Member

Summary

  • TOML/Dotenv: Escape \\\ and "\" in values; dotenv also escapes newlines → \n
  • XML: Escape key names in name attribute via xml.EscapeText + ""
  • HCL: Add missing \\\ escaping (already escaped " but not backslashes)

Test plan

  • Added TestExportDotenv_Escaping — quotes, backslashes, newlines, combined
  • Added TestExportTOML_Escaping — quotes, backslashes, combined
  • Added TestExportXML_KeyEscaping — roundtrip with ", &, <> in keys
  • Added TestExportHCL_Escaping — quotes and backslashes
  • All existing export tests still pass

TOML and dotenv values with embedded double quotes or backslashes
produced invalid output. XML key names in the name attribute were
not escaped. HCL was missing backslash escaping.
@cloudflare-workers-and-pages
Copy link
Copy Markdown

cloudflare-workers-and-pages bot commented Mar 13, 2026

Deploying phase-cli-install-script with  Cloudflare Pages  Cloudflare Pages

Latest commit: 38afa93
Status: ✅  Deploy successful!
Preview URL: https://6e85e06f.phase-cli-install-script.pages.dev
Branch Preview URL: https://fix-export-escaping.phase-cli-install-script.pages.dev

View logs

@nimish-ks nimish-ks self-assigned this Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant