The image saved in S3 doesn't match the original file

0

We're using AWS SDK .Net for storing files into S3 bucket and using provided examples to work with S3 bucket for upload, download, delete files. The bucket itself doesn't have any file extensions restrictions.

Everything works perfect (upload, download, delete objects, etc) except image files (.jpg, .png) uploaded to the S3 doesn't match the original files and can't be downloaded correctly. The size of the files in the storage at least is 1.5 times the size of the original files and MD5 hash is different from the original.

And at the same time text files (.txt) stored and downloaded in correct way as expected.

Can anyone helps to understand why this could be happened?

Dmitry
已提问 2 年前1863 查看次数
2 回答
0
已接受的回答

The problem was an incorrect AWS API gateway setting. After adding necessaries binary media types there (like image/jpg, image/png) the image files were successfully uploaded and totally matched with originals.

Dmitry
已回答 2 年前
0

Hi,

S3 does not change/manipulate objects. Once an object has been uploaded to S3 bucket, it remains same, no matter how many times you download it.

The ETag represents a specific version of the object. It reflects changes only to the contents of an object, not its metadata. The ETag may or may not be an MD5 digest of the object data. Whether or not it is depends on how the object was created and how it is encrypted as described in the following documeantation:

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

Thanks.

AWS
已回答 2 年前

您未登录。 登录 发布回答。

一个好的回答可以清楚地解答问题和提供建设性反馈,并能促进提问者的职业发展。

回答问题的准则