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

Wrong md5 comparison in case of multipart upload #68

Open
alex-pekurovsky opened this issue Mar 14, 2016 · 2 comments
Open

Wrong md5 comparison in case of multipart upload #68

alex-pekurovsky opened this issue Mar 14, 2016 · 2 comments

Comments

@alex-pekurovsky
Copy link

If file was uploaded to bucket using multipart upload (which is nowadays default behavior of most of SDK), it's ETag is not md5 of the file. And s3_file provider compares md5 of local file with ETag. Currently, as workaround, I'm reuploading files with older PUT method, however need some procedure to support multipart uploaded files.

@mattlqx
Copy link
Contributor

mattlqx commented Aug 1, 2017

Further, if an object was uploaded with encryption, it won't have an ETag that's an MD5 of the file either.

From http://docs.aws.amazon.com/AmazonS3/latest/API/RESTCommonResponseHeaders.html:

Objects created by the PUT Object, POST Object, or Copy operation, or through the AWS Management Console, and are encrypted by SSE-C or SSE-KMS, have ETags that are not an MD5 digest of their object data.

Using the ETag against the local file content isn't a reliable method to determine if the file has changed. Amazon has simply overloaded that header too much and provides no other determinators in the header to differentiate between the format.

I'm thinking the best solution would be to keep a catalog of ETags when s3_file downloads something and use that on subsequent runs to determine if there is a change, then it's apples-to-apples and you don't have to worry about what information the ETag is derived from.

@joekiller
Copy link
Collaborator

Merged the fix. please test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants