fix: prevent URL-encoded characters from being corrupted in Terraform output#2514
Open
breardon2011 wants to merge 1 commit intodiggerhq:developfrom
Open
fix: prevent URL-encoded characters from being corrupted in Terraform output#2514breardon2011 wants to merge 1 commit intodiggerhq:developfrom
breardon2011 wants to merge 1 commit intodiggerhq:developfrom
Conversation
… output Fixes diggerhq#2510 The issue was caused by incorrect use of fmt.Sprintf where Terraform output containing URL-encoded characters (like %2F) was passed as a format argument. Go's fmt.Sprintf interpreted these percent signs as format verbs, resulting in corrupted output like %!(MISSING)F(MISSING). Changes made: - backend/controllers/projects_helpers.go: Use string concatenation instead of fmt.Sprintf for Terraform output to avoid format verb interpretation - backend/utils/comment_utils.go: Escape percent signs in URLs and project names by replacing % with %% in fmt.Sprintf calls - libs/comment_utils/summary/updater.go: Apply same escaping for CLI updater - libs/comment_utils/reporting/source_grouping.go: Escape project names and locations in grouped reporting - cli/pkg/drift/github_issue.go: Use string concatenation for drift messages containing Terraform plan output - ee/cli/pkg/comment_updater/updater.go: Escape all user-controlled strings in EE comment updater The fix ensures that URL-encoded characters and any other percent signs in resource IDs, URLs, and project names are properly handled and displayed correctly in GitHub PR comments. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Contributor
Author
|
this was a test written by the ai project, ignore |
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
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