diff --git a/lib/cdn/aws.js b/lib/cdn/aws.js index f91037e..a782f33 100644 --- a/lib/cdn/aws.js +++ b/lib/cdn/aws.js @@ -85,11 +85,14 @@ CDN.prototype.executeUpload = function (action) { dfrd = Q.defer(); options = { Bucket: this.cfg.Bucket, - //ContentEncoding: '', ContentType: action.file.headers['Content-Type'], Key: action.file.path }; + if (action.file.headers['Content-Encoding']) { + options.ContentEncoding = action.file.headers['Content-Encoding']; + } + action.file.getBuffer().then(function (buffer) { options.Body = buffer; self.api.putObject(options, function (err) { // (err, res) diff --git a/lib/filelist.js b/lib/filelist.js index 53286df..99b4a21 100644 --- a/lib/filelist.js +++ b/lib/filelist.js @@ -89,7 +89,10 @@ FileList.prototype.applyStrategy = function (strategy) { dfrd.reject(new TypeError('provided strategy should be Array or String')); return dfrd.promise; } - // if (strategy.indexOf('clone') !== -1) {} // no work necessary + if (strategy.indexOf('clone') !== -1) { + dfrd.resolve(new FileList(this)); + return dfrd.promise; + } if (strategy.indexOf('gzip') !== -1) { gzips = this.map(function (file) { file.file = file; diff --git a/lib/gzippedfile.js b/lib/gzippedfile.js index 451cd76..e23a569 100644 --- a/lib/gzippedfile.js +++ b/lib/gzippedfile.js @@ -49,7 +49,12 @@ var GzippedFile = function (file) { self.calculateMD5() ]; }).spread(function (buffer) { - self.size = Buffer.byteLength(buffer.toString()); + // from the docs, I should not use buffer.length here + // but it happens to match Content-Length from AWS perfectly ??? + // alternatives: + // - buffer.toString().length + // - Buffer.byteLength(buffer.toString()) + self.size = buffer.length; process.nextTick(function () { dfrd.resolve(self); });