azd x - fix HTML-escaping of <, >, & in registry.json on publish#8498
Merged
Conversation
Copilot
AI
changed the title
[WIP] Fix HTML-escaping of special characters in registry.json
Fix HTML-escaping of May 30, 2026
<, >, & in registry.json on publish
Co-authored-by: JeffreyCA <9157833+JeffreyCA@users.noreply.github.com>
b262a3e to
add3e2c
Compare
vhvb1989
approved these changes
Jun 2, 2026
<, >, & in registry.json on publishazd x - fix HTML-escaping of <, >, & in registry.json on publish
📋 Milestone: June 2026This work is tracked for June 2026. The team will review it soon! |
Contributor
There was a problem hiding this comment.
Pull request overview
This PR updates the microsoft.azd.extensions developer kit publishing flow to avoid JSON HTML-escaping (<, >, &) when writing registry.json, preventing noisy diffs during republish and aligning local registry creation with the same behavior.
Changes:
- Switch registry writing to
json.EncoderwithSetEscapeHTML(false)for both publish-time saves and local registry initialization. - Add a regression test to ensure
<,>, and&remain literal (and that the file ends with a newline). - Bump the extension version to
0.11.1and add a changelog entry.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| cli/azd/extensions/microsoft.azd.extensions/internal/cmd/publish.go | Writes registry.json via json.Encoder with HTML escaping disabled. |
| cli/azd/extensions/microsoft.azd.extensions/internal/helpers.go | Applies the same non-HTML-escaping JSON encoder to local registry creation. |
| cli/azd/extensions/microsoft.azd.extensions/internal/cmd/publish_test.go | Adds a test to assert <, >, & are not escaped and output ends with a newline. |
| cli/azd/extensions/microsoft.azd.extensions/version.txt | Bumps extension version to 0.11.1. |
| cli/azd/extensions/microsoft.azd.extensions/extension.yaml | Updates the extension manifest version to 0.11.1. |
| cli/azd/extensions/microsoft.azd.extensions/CHANGELOG.md | Adds a 0.11.1 changelog entry describing the fix. |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
vhvb1989
approved these changes
Jun 3, 2026
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.
azd x publishrewrote literal<,>, and&incli/azd/extensions/registry.jsonto\u003c,\u003e,\u0026on every republish, producing noisy diffs in registry PRs. Root cause:json.MarshalIndentHTML-escapes by default with no opt-out.Changes
internal/cmd/publish.go—saveRegistrynow uses ajson.EncoderwithSetEscapeHTML(false), writing the three characters literally.internal/helpers.go— Applied the same encoder to the empty-registry writer inCreateLocalRegistryfor consistency.internal/cmd/publish_test.go— Added a test asserting literal characters survive a round-trip and are not escaped.Output is identical to before except
<,>,&are literal andEncoder.Encodeappends a trailing newline (conventional for files).