Closed n-johnson closed 7 years ago
I reverted the change that addressed this, as it does not appear that sending the body as a buffer has the intended effect in all clients. According to S3's documentation, metadata keys and values should only use characters from the US-ASCII character set. If S3 receives UTF-8 characters, it re-encode the header in RFC 2047 MIME encoding after verifying the signature. S3 will not decode the metadata when the object is retrieved, meaning that clients will receive the value not as multibyte char ç
but instead as =?UTF-8?Q?multibyte_char_=C3=A7?=
, which they may or may not decode automatically.
This behavior seems not to occur when the body is sent in the same TCP packet as the headers, which is why you see a difference between sending strings (which node attempts to concatenate with the headers) and buffers (which node sends separately). In either case, it's probably not what you want to happen, so this should be handled by URL-encoding metadata values before passing them to the SDK.
When a multibyte utf-8 character is included in the Metadata object, the sdk currently generates an invalid signature causing upload to fail if the
Body
is a string. However if a buffer is used, the correct signature is generated.Simple example:
Output: