2

So I have this issue that whenever I try to post a file to the s3 bucket with a pre-signed URL, the key for the metadata is being forced in lowercases?

I've looked at the Pre-signed URL it already sets the lowercase part when the URL has been genereted and Im wondering why? and how do I solve this issue?

I've tried to create a manual key-value pair in the s3 bucket on a file, where I clearly can set a key with capital letters as well?

   const params = {
        Bucket: 'buckets3',
        Key: 'hoho-fileUpload-' + uuid.v4(),
        Metadata: {"FooBar": "FooBar"},
        Expires: 600
    };

current output in the s3:

x-amz-meta-foobar: FooBar

Wishing output:

x-amz-meta-FooBar: FooBar

StrawHat
  • 351
  • 1
  • 6
  • 14

2 Answers2

5

There is nothing you can do, AWS stores S3 metadata in lower case.

User-defined metadata is a set of key-value pairs. Amazon S3 stores user-defined metadata keys in lowercase.

From: Object Meta Data and scroll to the bottom. It's the paragraph just above the Note.

WaltDe
  • 1,715
  • 8
  • 17
1

On top of WaltDe's answered, I'd recommend you convert your metadata keys to kebab case when sending to aws s3 (foo-bar) so you can convert it back to pascal case in your lambda or code or wherever you use the metadata.

NiRR
  • 4,782
  • 5
  • 32
  • 60