Skip to content

Commit 96dbe16

Browse files
committed
Add ability to configure ACL permissions
Right now, permissions are hard-coded to 'public-read'. This change adds a new prop to DropzoneS3Uploader called aclPermissions. The value is a string. Any canned aws ACL should be valid, we are using 'private' for our purposes. http://docs.aws.amazon.com/AmazonS3/latest/dev/acl-overview.html#canned-acl. Also, we are specifying the directory for babel in our build commands.
1 parent 3f55cac commit 96dbe16

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
"url": "https://github.com/founderlab/react-dropzone-s3-uploader"
1414
},
1515
"scripts": {
16-
"prepublish": "rm -rf ./lib && babel ./src --ignore '/node_modules/' --out-dir ./lib",
17-
"build": "rm -rf ./lib && babel ./src --ignore '/node_modules/' --out-dir ./lib",
18-
"watch": "rm -rf ./lib && babel ./src --ignore '/node_modules/' --watch --out-dir ./lib",
16+
"prepublish": "rm -rf ./lib && ./node_modules/babel/bin/babel.js ./src --ignore '/node_modules/' --out-dir ./lib",
17+
"build": "rm -rf ./lib && ./node_modules/babel/bin/babel.js ./src --ignore '/node_modules/' --out-dir ./lib",
18+
"watch": "rm -rf ./lib && ./node_modules/babel/bin/babel.js ./src --ignore '/node_modules/' --watch --out-dir ./lib",
1919
"test": "eval $(cat test/.env) mocha test/**/*.tests.js"
2020
},
2121
"dependencies": {

src/DropzoneS3Uploader.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ export default class DropzoneS3Uploader extends React.Component {
1111
notDropzoneProps: PropTypes.array.isRequired,
1212
isImage: PropTypes.func.isRequired,
1313
passChildrenProps: PropTypes.bool,
14+
aclPermissions: PropTypes.string,
1415

1516
imageComponent: PropTypes.func,
1617
fileComponent: PropTypes.func,
@@ -42,6 +43,7 @@ export default class DropzoneS3Uploader extends React.Component {
4243

4344
static defaultProps = {
4445
upload: {},
46+
aclPermissions: 'public-read',
4547
className: 'react-dropzone-s3-uploader',
4648
passChildrenProps: true,
4749
isImage: filename => filename && filename.match(/\.(jpeg|jpg|gif|png|svg)/i),
@@ -89,7 +91,7 @@ export default class DropzoneS3Uploader extends React.Component {
8991
signingUrl: '/s3/sign',
9092
s3path: '',
9193
contentDisposition: 'auto',
92-
uploadRequestHeaders: {'x-amz-acl': 'public-read'},
94+
uploadRequestHeaders: {'x-amz-acl': props.aclPermissions },
9395
onFinishS3Put: this.handleFinish,
9496
onProgress: this.handleProgress,
9597
onError: this.handleError,

0 commit comments

Comments
 (0)