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
demandé il y a 2 ans1861 vues
2 réponses
0
Réponse acceptée

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
répondu il y a 2 ans
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
répondu il y a 2 ans

Vous n'êtes pas connecté. Se connecter pour publier une réponse.

Une bonne réponse répond clairement à la question, contient des commentaires constructifs et encourage le développement professionnel de la personne qui pose la question.

Instructions pour répondre aux questions