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 3.4.0 to 4.0.0

6

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

@@ -29,5 +29,3 @@ "main": "index.js",

"node-uuid": "1.x",
"object-assign": "^2.0.0",
"latinize": "0.2.x",
"unorm": "1.4.x"
"object-assign": "^2.0.0"
},

@@ -34,0 +32,0 @@ "peerDependencies": {

@@ -9,3 +9,3 @@ react-s3-uploader

```bash
$ npm install react-s3-uploader
$ npm install --save react-s3-uploader
```

@@ -22,3 +22,3 @@ From Browser

signingUrl="/s3/sign"
signingUrlMethod="POST" // default "GET"
signingUrlMethod="GET"
accept="image/*"

@@ -32,8 +32,9 @@ preprocess={this.onUploadStart}

signingUrlWithCredentials={ true } // in case when need to pass authentication credentials via CORS
uploadRequestHeaders={{ 'x-amz-acl': 'public-read' }}
uploadRequestHeaders={{ 'x-amz-acl': 'public-read' }} // this is the default
contentDisposition="auto"
scrubFilename={(filename) => filename.replace(/[^\w\d_\-\.]+/ig, '')}
server="http://cross-origin-server.com" />
```
The above example shows all supported `props`. For `uploadRequestHeaders`, the default ACL is shown.
The above example shows all supported `props`.

@@ -52,2 +53,4 @@ This expects a request to `/s3/sign` to return JSON with a `signedUrl` property that can be used

Use `scrubFilename` to provide custom filename scrubbing before uploading. Prior to version 4.0, this library used `unorm` and `latinize` to filter out characters. Since 4.0, we simply remove all characters that are not alphanumeric, underscores, dashes, or periods.
The resulting DOM is essentially:

@@ -190,2 +193,6 @@

##### 4.0.0
* BREAKING CHANGE: Removed `unorm` and `latinize` dependencies, which were used to scrub file names before uploading. Now we just remove all characters that are not alphanumeric, underscores, dashes, or periods. If you need different behavior, please provide a custom `scrubFilename` function in props.
##### 3.4.0

@@ -192,0 +199,0 @@

@@ -6,5 +6,2 @@ /**

var latinize = require('latinize'),
unorm = require('unorm');
S3Upload.prototype.server = '';

@@ -33,2 +30,6 @@ S3Upload.prototype.signingUrl = '/sign-s3';

S3Upload.prototype.scrubFilename = function(filename) {
return filename.replace(/[^\w\d_\-\.]+/ig, '');
};
function S3Upload(options) {

@@ -80,4 +81,3 @@ if (options == null) {

S3Upload.prototype.executeOnSignedUrl = function(file, callback) {
var normalizedFileName = unorm.nfc(file.name.replace(/[!\^`><{}\[\]()*#%'"~|&@:;$=+?\s\\\/\x00-\x1F\x7f]+/ig, '_'));
var fileName = latinize(normalizedFileName);
var fileName = this.scrubFilename(file.name);
var queryString = '?objectName=' + fileName + '&contentType=' + encodeURIComponent(file.type);

@@ -152,4 +152,4 @@ if (this.signingUrlQueryParams) {

}
var normalizedFileName = unorm.nfc(file.name.replace(/[!\^`><{}\[\]()*#%'"~|&@:;$=+?\s\\\/\x00-\x1F\x7f]+/ig, '_'));
var fileName = latinize(normalizedFileName);
var fileName = this.scrubFilename(file.name)
xhr.setRequestHeader('Content-Disposition', disposition + '; filename="' + fileName + '"');

@@ -156,0 +156,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