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
gefragt vor 2 Jahren1863 Aufrufe
2 Antworten
0
Akzeptierte Antwort

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
beantwortet vor 2 Jahren
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
beantwortet vor 2 Jahren

Du bist nicht angemeldet. Anmelden um eine Antwort zu veröffentlichen.

Eine gute Antwort beantwortet die Frage klar, gibt konstruktives Feedback und fördert die berufliche Weiterentwicklung des Fragenstellers.

Richtlinien für die Beantwortung von Fragen