Socket
Socket
Sign inDemoInstall

react-s3-uploader

Package Overview
Dependencies
Maintainers
1
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-s3-uploader - npm Package Compare versions

Comparing version 4.3.0 to 4.4.0

5

CHANGELOG.md
##### 4.4.0
* Support `getS3` function in bundled router options [#139]
* Support `s3Path` string prefix prop [#140]
##### 4.3.0

@@ -3,0 +8,0 @@

2

package.json
{
"name": "react-s3-uploader",
"version": "4.3.0",
"version": "4.4.0",
"description": "React component that renders a file input and automatically uploads to an S3 bucket",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -32,3 +32,4 @@ "use strict";

server: PropTypes.string,
scrubFilename: PropTypes.func
scrubFilename: PropTypes.func,
s3path: PropTypes.string
},

@@ -55,3 +56,4 @@

return filename.replace(/[^\w\d_\-\.]+/ig, '');
}
},
s3path: ''
};

@@ -76,3 +78,4 @@ },

server: this.props.server,
scrubFilename: this.props.scrubFilename
scrubFilename: this.props.scrubFilename,
s3path: this.props.s3path
});

@@ -79,0 +82,0 @@ },

@@ -23,2 +23,3 @@ react-s3-uploader

accept="image/*"
s3path="/uploads/"
preprocess={this.onUploadStart}

@@ -128,2 +129,5 @@ onProgress={this.onUploadProgress}

If you need to use pass more than region and signatureVersion to S3 instead use the `getS3` param. `getS3` accepts a
function that returns a new AWS.S3 instance. This is also useful if you want to mock S3 for testing purposes.
**To use this you will need to include the [express module](https://www.npmjs.com/package/express) in your package.json dependencies.**

@@ -130,0 +134,0 @@

@@ -26,9 +26,17 @@ var uuidv4 = require('uuid/v4'),

var s3Options = {};
if (options.region) {
s3Options.region = options.region;
}
if (options.signatureVersion) {
var getS3 = options.getS3;
if (!getS3) {
var s3Options = {};
if (options.region) {
s3Options.region = options.region;
}
if (options.signatureVersion) {
s3Options.signatureVersion = options.signatureVersion;
}
getS3 = function() {
return new aws.S3(s3Options);
};
}
if (options.uniquePrefix === undefined) {

@@ -49,3 +57,3 @@ options.uniquePrefix = true;

};
var s3 = new aws.S3(s3Options);
var s3 = getS3();
s3.getSignedUrl('getObject', params, function(err, url) {

@@ -83,3 +91,3 @@ res.redirect(url);

var s3 = new aws.S3(s3Options);
var s3 = getS3();
var params = {

@@ -86,0 +94,0 @@ Bucket: S3_BUCKET,

@@ -81,3 +81,3 @@ /**

var fileName = this.scrubFilename(file.name);
var queryString = '?objectName=' + fileName + '&contentType=' + encodeURIComponent(file.type);
var queryString = '?objectName=' + this.s3path + fileName + '&contentType=' + encodeURIComponent(file.type);
if (this.signingUrlQueryParams) {

@@ -84,0 +84,0 @@ var signingUrlQueryParams = typeof this.signingUrlQueryParams === 'function' ? this.signingUrlQueryParams() : this.signingUrlQueryParams;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc