Skip to content

Commit 03bf3a8

Browse files
authored
Rename rawStringBytesDisplay to byteStringDisplay (#23909)
Follow-up to the byte string display support in #23870. The signature these values carry is named ByteString, so name the display helper to match. No behavior change.
1 parent 3344335 commit 03bf3a8

3 files changed

Lines changed: 5 additions & 5 deletions

File tree

‎pkg/backend/display/json.go‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ import (
3434
"github.com/pulumi/pulumi/sdk/v3/go/common/util/logging"
3535
)
3636

37-
// rawStringBytesDisplay renders a string containing bytes that are not valid UTF-8 as b"<base64>",
37+
// byteStringDisplay renders a string containing bytes that are not valid UTF-8 as b"<base64>",
3838
// since such strings cannot be represented in JSON or terminal output directly.
39-
func rawStringBytesDisplay(s string) string {
39+
func byteStringDisplay(s string) string {
4040
return `b"` + base64.StdEncoding.EncodeToString([]byte(s)) + `"`
4141
}
4242

@@ -46,7 +46,7 @@ func rawStringBytesDisplay(s string) string {
4646
func massagePropertyValue(v resource.PropertyValue, showSecrets bool) resource.PropertyValue {
4747
switch {
4848
case v.IsString() && !utf8.ValidString(v.StringValue()):
49-
return resource.NewProperty(rawStringBytesDisplay(v.StringValue()))
49+
return resource.NewProperty(byteStringDisplay(v.StringValue()))
5050
case v.IsArray():
5151
new := make([]resource.PropertyValue, len(v.ArrayValue()))
5252
for i, e := range v.ArrayValue() {

‎pkg/backend/display/object_diff.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,7 @@ func (p *propertyPrinter) printPrimitivePropertyValue(v resource.PropertyValue)
980980
}
981981
} else if v.IsString() {
982982
if !utf8.ValidString(v.StringValue()) {
983-
p.writeVerbatim(rawStringBytesDisplay(v.StringValue()))
983+
p.writeVerbatim(byteStringDisplay(v.StringValue()))
984984
return
985985
}
986986
if vv, kind, ok := p.decodeValue(v.StringValue()); ok {

‎pkg/backend/display/object_diff_test.go‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ func Test_PrintObject(t *testing.T) {
164164
true,
165165
},
166166
{
167-
"raw_string_bytes",
167+
"byte_string",
168168
resource.NewPropertyMapFromMap(map[string]any{
169169
"bytes": resource.NewProperty("\x00hello \x80\xfe\xff world\xf0\x28"),
170170
}),

0 commit comments

Comments
 (0)