Skip to content

Commit

Permalink
Take filePattern into account when determining isGzipped status
Browse files Browse the repository at this point in the history
Hardcoding `index.html` limits the flexibility here; using `filePattern` sets
Content-Encoding header properly when file differs from `index.html`.
  • Loading branch information
elidupuis committed Mar 4, 2016
1 parent ddd966a commit 194be5c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ module.exports = CoreObject.extend({
var revisionKey = joinUriSegments(options.prefix, key);
var putObject = Promise.denodeify(client.putObject.bind(client));
var gzippedFilePaths = options.gzippedFilePaths || [];
var isGzipped = gzippedFilePaths.indexOf('index.html') !== -1;
var isGzipped = gzippedFilePaths.indexOf(options.filePattern) !== -1;

var params = {
Bucket: bucket,
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/lib/s3-nodetest.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,8 @@ describe('s3', function() {
});
});

it('sets the Content-Encoding header to gzip when the index file is gziped', function() {
options.gzippedFilePaths = ['index.html'];
it('sets the Content-Encoding header to gzip when the index file is gzipped', function() {
options.gzippedFilePaths = [filePattern];
var promise = subject.upload(options);

return assert.isFulfilled(promise)
Expand Down

0 comments on commit 194be5c

Please sign in to comment.