Skip to content

Commit 194be5c

Browse files
committed
Take filePattern into account when determining isGzipped status
Hardcoding `index.html` limits the flexibility here; using `filePattern` sets Content-Encoding header properly when file differs from `index.html`.
1 parent ddd966a commit 194be5c

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

lib/s3.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ module.exports = CoreObject.extend({
4444
var revisionKey = joinUriSegments(options.prefix, key);
4545
var putObject = Promise.denodeify(client.putObject.bind(client));
4646
var gzippedFilePaths = options.gzippedFilePaths || [];
47-
var isGzipped = gzippedFilePaths.indexOf('index.html') !== -1;
47+
var isGzipped = gzippedFilePaths.indexOf(options.filePattern) !== -1;
4848

4949
var params = {
5050
Bucket: bucket,

tests/unit/lib/s3-nodetest.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -137,8 +137,8 @@ describe('s3', function() {
137137
});
138138
});
139139

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

144144
return assert.isFulfilled(promise)

0 commit comments

Comments
 (0)