pulumi/pkg/backend/display/testdata
Justin Van Patten 82c546d873
Fix mangled diffs of strings containing url-encoded chars (#16147)
Fix mangled diffs of strings containing url-encoded chars

Currently, modifying a stack output that contains url-encoded characters
can lead to it showing the value as `"!(NOVERB)"` or `"!(MISSING)"`.

For example, changing a stack output `path` from `"%2F"` to `"%2f"`
shows the diff as:

```
Outputs:
  ~ path: "%!(NOVERB)F" => "%!(NOVERB)f"
```

The expected diff output should be:

```
Outputs:
  ~ path: "%2F" => "%2f"
```

This is happening because the code that emits parts of the diff is
expecting a format string. Go is trying to parse the `%` in the value as
a format string and is having problems parsing it.

The fix is to emit the parts of the diff verbatim, so it isn't treated
as a format string.

Fixes #16123

Note: I've done an audit of the other calls to `write` in
`object_diff.go` and all the other call sites are passing actual format
strings or constants. This was the only case where we were passing user
input as a format string.
2024-05-08 08:23:40 +00:00
..
json-yaml Fix JSON/YAML diffs (#15171) 2024-01-18 14:19:54 +00:00
not-truncated Fix mangled diffs of strings containing url-encoded chars (#16147) 2024-05-08 08:23:40 +00:00
truncated Never show property diffs for OpSame (#16024) 2024-05-02 12:28:43 +00:00
.gitattributes [cli] Refactor the diff printer. (#9367) 2022-04-09 16:04:35 -07:00