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.2.0 to 4.3.0

5

CHANGELOG.md
##### 4.3.0
* Support middleware in express module with optional second arg
* Allow 200 or 201 for success on sign request
##### 4.2.0

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

2

package.json
{
"name": "react-s3-uploader",
"version": "4.2.0",
"version": "4.3.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,3 @@ react-s3-uploader

contentDisposition="auto"
scrubFilename={(filename) => filename.replace(/[^\w\d_\-\.]+/ig, '')}
scrubFilename={(filename) => filename.replace(/[^\w\d_\-.]+/ig, '')}
server="http://cross-origin-server.com" />

@@ -35,0 +35,0 @@ ```

@@ -13,4 +13,8 @@ var uuidv4 = require('uuid/v4'),

function S3Router(options) {
function S3Router(options, middleware) {
if (!middleware) {
middleware = [];
}
var S3_BUCKET = options.bucket,

@@ -54,3 +58,3 @@ getFileKeyDir = options.getFileKeyDir || function() { return ""; };

*/
router.get(/\/img\/(.*)/, function(req, res) {
router.get(/\/img\/(.*)/, middleware, function(req, res) {
return tempRedirect(req, res);

@@ -62,3 +66,3 @@ });

*/
router.get(/\/uploads\/(.*)/, function(req, res) {
router.get(/\/uploads\/(.*)/, middleware, function(req, res) {
return tempRedirect(req, res);

@@ -71,3 +75,3 @@ });

*/
router.get('/sign', function(req, res) {
router.get('/sign', middleware, function(req, res) {
var filename = (options.uniquePrefix ? uuidv4() + "_" : "") + req.query.objectName;

@@ -74,0 +78,0 @@ var mimeType = req.query.contentType;

@@ -9,2 +9,3 @@ /**

S3Upload.prototype.signingUrlMethod = 'GET';
S3Upload.prototype.signingUrlSuccessResponses = [200, 201];
S3Upload.prototype.fileElement = null;

@@ -100,3 +101,3 @@ S3Upload.prototype.files = null;

xhr.onreadystatechange = function() {
if (xhr.readyState === 4 && xhr.status === 200) {
if (xhr.readyState === 4 && this.signingUrlSuccessResponses.indexOf(xhr.status) >= 0) {
var result;

@@ -110,3 +111,3 @@ try {

return callback(result);
} else if (xhr.readyState === 4 && xhr.status !== 200) {
} else if (xhr.readyState === 4 && this.signingUrlSuccessResponses.indexOf(xhr.status) < 0) {
return this.onError('Could not contact request signing server. Status = ' + xhr.status, file);

@@ -113,0 +114,0 @@ }

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