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 年前

您尚未登入。 登入 去張貼答案。

一個好的回答可以清楚地回答問題並提供建設性的意見回饋,同時有助於提問者的專業成長。

回答問題指南