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 TransferUtility : incorrect support for object tagging on single/multipart upload #541

Closed
fdelaporte opened this issue Oct 11, 2018 · 8 comments
Assignees
Labels
bug Something isn't working closing soon Issue will auto-close if there is no additional activity within 7 days. pending-community-response Issue is pending response from the issue requestor s3 Issues with the AWS Android SDK for Simple Storage Service (S3).

Comments

@fdelaporte
Copy link

Describe the bug
Object tagging is not set when uploading files with size > 5MB

When file size is > 5MB there is only a x-amz-meta-x-amz-tagging metadata header set with actual tagging content

When file size is < 5MB, the tagging is correctly set but the wrong x-amz-meta-x-amz-tagging header is still set in addition to tagging

To Reproduce
For multipart upload:

  1. Build ObjectMetadata with addUserMetadata("x-amz-tagging", "key=value")
  2. Upload file with size > 5MB using TransferUtility.upload(bucket, key, file, objectMetadata)
  3. Check object properties on S3 AWS console
  4. No tagging on object properties, only a x-amz-meta-x-amz-tagging header

For single part upload:

  1. Build ObjectMetadata with addUserMetadata("x-amz-tagging", "key=value")
  2. Upload file with size < 5MB using TransferUtility.upload(bucket, key, file, objectMetadata)
  3. Check object properties on S3 AWS console
  4. Tagging with key/value correctly set, but wrong x-amz-meta-x-amz-tagging header also present

Expected behavior
There should be no x-amz-meta-x-amz-tagging header in any case, and tagging should be set for multipart upload

Environment:

  • SDK Version: 2.7.4

Device Information (please complete the following information):

  • Android Version: 7.1.1 API 25
@mutablealligator mutablealligator added the s3 Issues with the AWS Android SDK for Simple Storage Service (S3). label Oct 11, 2018
@mutablealligator mutablealligator self-assigned this Oct 11, 2018
@minbi minbi changed the title S3 TransfertUtility : incorrect support for object tagging on single/multipart upload S3 TransferUtility : incorrect support for object tagging on single/multipart upload Oct 11, 2018
@mutablealligator
Copy link
Contributor

@fdelaporte Sorry for the inconvenience caused. I'm looking into reproducing the issue.

@fdelaporte
Copy link
Author

fdelaporte commented Oct 12, 2018

@kvasukib That's allright. As of now I'm using metadata to work around the problem. I initially intended to use tagging inside a lambda triggered by S3 object creation, so in the mean time I'm juste getting object headers instead of tags.

Please let me know if you need clarifications.

Thanks

@mutablealligator
Copy link
Contributor

@fdelaporte When you say "I'm using metadata to work around the problem", can you post a code snippet of how you are accomplishing this?

@fdelaporte
Copy link
Author

@kvasukib Sorry that wasn't clear. What I meant by that is that I'm setting the values I need through metadata instead of tagging, not that I had found a way to put tagging somehow.

So for instance if I need the tag myKey=myValue, instead of doing:
objectMetadata.addUserMetadata("x-amz-tagging", "myKey=myValue")

I can do instead:
objectMetadata.addUserMetadata("myKey", "myValue")

And then I can fetch the x-amz-meta-mykey header on S3 in my lambda.

The point was to say that in my scenario this bug is not show stopper.

@mutablealligator
Copy link
Contributor

@fdelaporte Thank you for the confirmation. The intention of the SDK is to support objectMetadata.addUserMetadata("x-amz-tagging", "myKey=myValue") and then have the right metadata appear in the S3 console. This should be a bug in how we are passing it to S3. I am investigating in the code. Will post a reply once I know the root cause.

@frankmuellr frankmuellr added the bug Something isn't working label Oct 15, 2018
@mutablealligator
Copy link
Contributor

@fdelaporte Sorry for the delayed response. I am able to reproduce the issue successfully.

Single-part upload:

        ObjectMetadata objectMetadata = new ObjectMetadata();
        objectMetadata.addUserMetadata("x-amz-tagging", "key1=value1"); // Appears on Metadata and Tags on S3 Console
        objectMetadata.addUserMetadata("key2", "value2"); // Appears only on Metadata

        TransferObserver observer = transferUtility.upload(
                file.getName(),
                file,
                objectMetadata
        );

Multi-part upload:

        ObjectMetadata objectMetadata = new ObjectMetadata();
        objectMetadata.addUserMetadata("x-amz-tagging", "key1=value1"); // Appears on Metadata only on S3 Console
        objectMetadata.addUserMetadata("key2", "value2"); // Appears only on Metadata

        TransferObserver observer = transferUtility.upload(
                file.getName(),
                file,
                objectMetadata
        );

I see that for multi-part uploads, the Tags miss the key1=value1. I will look into fixing it.

@palpatim palpatim added pending-release Code has been merged but pending release pending-community-response Issue is pending response from the issue requestor and removed Investigating pending-release Code has been merged but pending release labels Aug 23, 2019
@palpatim
Copy link
Member

This was released on 2.15.1. Please let us know if you continue to have problems.

@palpatim palpatim added the closing soon Issue will auto-close if there is no additional activity within 7 days. label Aug 23, 2019
@stale
Copy link

stale bot commented Aug 30, 2019

This issue has been automatically closed because of inactivity. Please open a new issue if are still encountering problems.

@stale stale bot closed this as completed Aug 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working closing soon Issue will auto-close if there is no additional activity within 7 days. pending-community-response Issue is pending response from the issue requestor s3 Issues with the AWS Android SDK for Simple Storage Service (S3).
Projects
None yet
Development

No branches or pull requests

4 participants