Skip to content

Commit

Permalink
Bubble up force encoding binary
Browse files Browse the repository at this point in the history
  • Loading branch information
mullermp committed May 31, 2024
1 parent 396d50d commit db5fbba
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion gems/aws-sdk-core/lib/aws-sdk-core/cbor/decoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def read_integer

def read_binary_string
_major_type, add_info = read_info
take(read_count(add_info)).force_encoding(Encoding::BINARY)
take(read_count(add_info))
end

def read_string
Expand Down
4 changes: 2 additions & 2 deletions gems/aws-sdk-core/lib/aws-sdk-core/cbor/encoder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def initialize

# @return the encoded bytes in CBOR format for all added data
def bytes
@buffer
@buffer.force_encoding(Encoding::BINARY)
end

# generic method for adding generic Ruby data based on its type
Expand Down Expand Up @@ -174,7 +174,7 @@ def add_byte_string(value)
end

def add_string(value)
value = value.encode(Encoding::UTF_8).force_encoding(Encoding::BINARY)
value = value.encode(Encoding::UTF_8)
head(MAJOR_TYPE_STR, value.bytesize)
@buffer << value
end
Expand Down
2 changes: 1 addition & 1 deletion gems/aws-sdk-core/lib/aws-sdk-core/rpc_v2/builder.rb
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ def map(ref, values)
end

def blob(value)
(String === value ? value : value.read).force_encoding(Encoding::BINARY)
String === value ? value : value.read
end

def format(ref, value)
Expand Down

0 comments on commit db5fbba

Please sign in to comment.