fix: prevent URL-encoded characters from being corrupted in Terraform output #2514
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
Fixes #2510
This PR fixes a critical bug where URL-encoded characters (like
%2F) in Terraform resource IDs were being corrupted into%!(MISSING)F(MISSING)in GitHub PR comments.Root Cause
The issue was caused by incorrect use of
fmt.Sprintfwhere Terraform output containing URL-encoded characters was passed as format arguments. Go'sfmt.Sprintfinterprets%characters as format verbs, causing the corruption when strings like%2Fwere encountered.Changes Made
fmt.Sprintfwith string concatenation for Terraform outputstrings.ReplaceAllto escape%characters in URLs and project namesTesting
The fix ensures that:
Impact
This fix particularly affects:
google_service_networking_connection)/or other special characters in their IDs🤖 Generated with Claude Code