Following the information here, one would think that adding a non US-ASCII metadata value would be automatically handled
https://docs.aws.amazon.com/AmazonS3/latest/dev/UsingMetadata.html
So storing any unicode should work
Trying to store a non US-ASCII value fails with SignatureDoesNotMatch
and the error message:
The request signature we calculated does not match the signature you provided. Check your key and signing method.
The following code gives the error:
var s3c = new AmazonS3Client();
var por = new PutObjectRequest
{
ContentBody = "test",
BucketName = "bucket",
Key = "item-key"
};
por.Metadata.Add("UnicodeValue","拢");
s3c.PutObject(por);
Commenting out por.Metadata.Add("UnicodeValue","拢");
makes the call succeed
I store metadata about objects, and incoming name is one of them and that can be any Unicode
Looks like an issue with the SDK not encoding non-ascii characters.
https://github.com/aws/aws-sdk-net/blob/master/sdk/src/Services/S3/Custom/Util/AmazonS3Util.cs#L329-L333
Version 3.3.110.66 of AWSSDK.S3 has been released with the fix. Thanks for reporting the issue.
Thank you @normj !
Noticed the same issue with the toolkit, so raised the same issue there:
https://github.com/aws/aws-toolkit-visual-studio/issues/91
We had to revert this change in the version 3.3.111.1 of AWSSDK.S3 because it was causing a breaking change to user using the S3 encryption client or users that were encoding the metadata values themselves. https://github.com/aws/aws-sdk-net/issues/1617
We did add a new static property called EnableUnicodeEncodingForObjectMetadata
on the Amazon.S3. AWSConfigsS3
class that if you set to true will encode the non-ascii characters.
Most helpful comment
Version 3.3.110.66 of AWSSDK.S3 has been released with the fix. Thanks for reporting the issue.