I have a txt file with the following content without new line to the end of the file:
hello-world
The md5 of this file content is 2095312189753de6ad47dfe20cbe97ec
If I upload this file to an Amazon S3 bucket via web client, the file eTag is 8a8933dab8deebe52e30886da1ef6ee2
This eTag does not match with the expected uploaded file content md5.
The resulted md5 of the previous content plus and additional end of line to the end of file is 8a8933dab8deebe52e30886da1ef6ee2.
What matches the object eTag. Why is Amazon S3 adding an additional new line to the end of file for calculating the eTag?
If I upload a empty file the eTag matches the md5 of empty string (without adding a new line).
If I upload a file with a new line to the end of file the eTag matches the md5 of this content with one additional new line to the end file (so 2 new lines to the end).
What is the reason Amazon S3 adds this new line just for calculating the eTag? When I download the file the content does not have this additional new line to the end.
Additionally, what is the recommended way to check the integrity of a downloaded file from an Amazon S3 bucket when we do not have control over how this file was uploaded (multi-part uploading might be possible)?