aws/aws-sdk-java — pull request #225 by ankon (2014-05-07 08:44:09+00:00)
Title: Only calculate the MD5 from a file if it wasn't provided in the metadata

When using a S3 PutObject request with a File the AmazonS3Client will always calculate the MD5 by processing the file, regardless of whether the ContentMD5 metadata was provided.

This is in contrast to using an InputStream, where ContentMD5 is used when it is available, and only otherwise it is automatically calculated.

Apart from the obvious performance issue of reading a file again, there is also a slight problem of integrity here: if the disk fails, and returns wrong content it would be stored as "correct" in S3. I my case I do have the MD5 hash of the original content, and that's the one I want S3 to use as well :)