Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

S3 Metadata Keys are modified when returned. #2159

Closed
beiriannydd opened this issue Sep 23, 2018 · 3 comments
Closed

S3 Metadata Keys are modified when returned. #2159

beiriannydd opened this issue Sep 23, 2018 · 3 comments
Labels
duplicate This issue is a duplicate. feature-request A feature should be added or improved.

Comments

@beiriannydd
Copy link

beiriannydd commented Sep 23, 2018

Please fill out the sections below to help us address your issue.

Version of AWS SDK for Go?

v1.15.38

Version of Go (go version)?

1.10

What issue did you see?

Metadata returned from S3 objects has LeadingCapital conversion of keys

Steps to reproduce

Partial Example

md := map[string]*string {
  "example": AWSString("not Example"),
}
poi := &s3.PutObjectInput{
  Body: aws.ReadSeekCloser(source),
  Bucket: aws.String(bucket),
  Key: aws.String(key),
  Metadata: md,
  }
svc.PutObject(poi)
hoi := &s3.HeadObjectInput{
  Bucket: aws.String(bucket),
  Key:    aws.String(key),
}
result, _ := svc.HeadObject(hoi)
assert.Equal(reflect.DeepEqual(md, result.Metadata),true) // fails assertion

This fails because in result, the key is named "Example". I couldn't find documentation for this behavior and it is also surprising. If Example and example are given as keys then the result is the two values joined by ',' which makes sense, I suppose. I then tested "example_eg" and "ExampleEg" which generated two different keys, which further surprised. If you're going to modify the case to lower, why not use a method which has a way back to the original?

@beiriannydd
Copy link
Author

Ah #445

@beiriannydd
Copy link
Author

beiriannydd commented Sep 24, 2018

How would you feel about implementing an aws.Canon(s string) function to be used when generating Metadata in order to generate it in the same format as would be returned by the methods? That way the programmer can use the names they're familiar with and leave it to the library to ensure that the metadata is comparable? Basically it would return textproto.CanonicalMIMEHeaderKey(s). The important piece would be using this function everywhere metadata keys are used in examples and documentation.

@diehlaws diehlaws self-assigned this Sep 25, 2018
@diehlaws diehlaws added duplicate This issue is a duplicate. feature-request A feature should be added or improved. labels Sep 25, 2018
@diehlaws
Copy link
Contributor

Hi @beiriannydd, thanks or your feedback on this topic. In order to maintain organized discussions on issues we encourage commenting on existing issues rather than re-initiating the discussion on a new issue. I am closing this issue as a duplicate, however your feedback has been included in the internal discussion for the implementation of this feature.

@diehlaws diehlaws removed their assignment Aug 26, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
duplicate This issue is a duplicate. feature-request A feature should be added or improved.
Projects
None yet
Development

No branches or pull requests

2 participants