Skip to content

Commit 00e0c59

Browse files
authored
Merge pull request #134 from TraceGenomics/feature/acl-optional
Optionally ignore ACLs
2 parents 63e88b0 + 9209f40 commit 00e0c59

File tree

3 files changed

+31
-3
lines changed

3 files changed

+31
-3
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,8 @@ A file matching this pattern will be uploaded to S3. The active key in S3 will b
110110

111111
The ACL to apply to the objects.
112112

113+
Set to `false` to not apply any ACLs.
114+
113115
*Default:* `'public-read'`
114116

115117
### cacheControl
@@ -151,7 +153,7 @@ or Openstack Swift
151153

152154
If `endpoint` set the `region` option will be ignored.
153155

154-
*Default:* `[region].s3.amazonaws.com`
156+
*Default:* `[region].s3.amazonaws.com`
155157

156158

157159
### serverSideEncryption

index.js

+8-2
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ module.exports = {
6666
var options = {
6767
bucket: bucket,
6868
prefix: prefix,
69-
acl: acl,
7069
cacheControl: cacheControl,
7170
filePattern: filePattern,
7271
filePath: filePath,
@@ -77,6 +76,10 @@ module.exports = {
7776
urlEncodeSourceObject: urlEncodeSourceObject
7877
};
7978

79+
if (acl) {
80+
options.acl = acl;
81+
}
82+
8083
if (serverSideEncryption) {
8184
options.serverSideEncryption = serverSideEncryption;
8285
}
@@ -99,12 +102,15 @@ module.exports = {
99102
var options = {
100103
bucket: bucket,
101104
prefix: prefix,
102-
acl: acl,
103105
filePattern: filePattern,
104106
revisionKey: revisionKey,
105107
urlEncodeSourceObject: urlEncodeSourceObject,
106108
};
107109

110+
if (acl) {
111+
options.acl = acl;
112+
}
113+
108114
if (serverSideEncryption) {
109115
options.serverSideEncryption = serverSideEncryption;
110116
}

tests/unit/index-test.js

+20
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,16 @@ describe('s3-index plugin', function() {
147147
});
148148
});
149149

150+
it('filters acl when not defined', function() {
151+
context.config['s3-index'].acl = false;
152+
var promise = plugin.upload(context);
153+
154+
return assert.isFulfilled(promise)
155+
.then(function() {
156+
assert.equal(Object.prototype.hasOwnProperty.call(s3Options, 'acl'), false, 'acl filtered correctly');
157+
});
158+
});
159+
150160
it('passes cacheControl options based on the cacheControl option to the s3-abstraction', function() {
151161
var cacheControl = 'max-age=3600';
152162
context.config['s3-index'].cacheControl = cacheControl;
@@ -264,6 +274,16 @@ describe('s3-index plugin', function() {
264274
});
265275
});
266276

277+
it('filters acl when not defined', function() {
278+
context.config['s3-index'].acl = false;
279+
var promise = plugin.upload(context);
280+
281+
return assert.isFulfilled(promise)
282+
.then(function() {
283+
assert.equal(Object.prototype.hasOwnProperty.call(s3Options, 'acl'), false, 'acl filtered correctly');
284+
});
285+
});
286+
267287
it('displays activation message when revision is activated', function() {
268288
var promise = plugin.activate(context);
269289

0 commit comments

Comments
 (0)