grunt-s3
grunt-s3 copied to clipboard
Fix bug so that sync verify works with gzip correctly
Currently, if you try to sync
files with verify: true
and gzip: true
, it compares the md5 of the gzipped remote file with the non-gzipped local file, so the hashes never match.
So if the local file is newer, sync
will always upload, regardless of whether the content changed. For example, when a cron runs every minute and writes out a data file, it will always be uploaded to S3 even if the content is the same as the remote file.
This fixes the problem by just gzipping the local file before getting the md5 hash, assuming gzip: true
. It could be more efficient by caching the gzipped file and using it for upload later. In practice, even uploading 100+ files, it still takes just a second or two, the same as before.
Nice catch. Could you add some tests that confirm that verify
+gzip
behavior is fixed, and make sure this passes CI?