Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

rc-upload

Package Overview
Dependencies
Maintainers
5
Versions
137
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

rc-upload - npm Package Compare versions

Comparing version 4.1.0 to 4.2.0-alpha.0

4

es/AjaxUploader.d.ts
import React, { Component } from 'react';
import type { UploadProps, RcFile, BeforeUploadFileType } from './interface';
import type { UploadProps, RcFile } from './interface';
interface ParsedFileInfo {

@@ -7,3 +7,3 @@ origin: RcFile;

data: object;
parsedFile: Exclude<BeforeUploadFileType, boolean>;
parsedFile: RcFile;
}

@@ -10,0 +10,0 @@ declare class AjaxUploader extends Component<UploadProps> {

@@ -136,3 +136,3 @@ import _extends from "@babel/runtime/helpers/esm/extends";

var _ref2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee(file, fileList) {
var beforeUpload, transformedFile, action, mergedAction, data, mergedData, parsedFile;
var beforeUpload, transformedFile, action, mergedAction, data, mergedData, parsedData, parsedFile, mergedParsedFile;
return _regeneratorRuntime.wrap(function _callee$(_context) {

@@ -219,18 +219,24 @@ while (1) {

case 30:
parsedFile = // string type is from legacy `transformFile`.
parsedData = // string type is from legacy `transformFile`.
// Not sure if this will work since no related test case works with it
(_typeof(transformedFile) === 'object' || typeof transformedFile === 'string') && transformedFile ? transformedFile : file; // Used for `request.ts` get form data name
(_typeof(transformedFile) === 'object' || typeof transformedFile === 'string') && transformedFile ? transformedFile : file;
if (_typeof(parsedFile) === 'object' && !parsedFile.name) {
parsedFile.name = file.name;
if (parsedData instanceof File) {
parsedFile = parsedData;
} else {
parsedFile = new File([parsedData], file.name, {
type: file.type
});
}
mergedParsedFile = parsedFile;
mergedParsedFile.uid = file.uid;
return _context.abrupt("return", {
origin: file,
data: mergedData,
parsedFile: parsedFile,
parsedFile: mergedParsedFile,
action: mergedAction
});
case 33:
case 35:
case "end":

@@ -299,7 +305,7 @@ return _context.stop();

var onProgress = _this2.props.onProgress;
onProgress === null || onProgress === void 0 ? void 0 : onProgress(e, origin);
onProgress === null || onProgress === void 0 ? void 0 : onProgress(e, parsedFile);
},
onSuccess: function onSuccess(ret, xhr) {
var onSuccess = _this2.props.onSuccess;
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(ret, origin, xhr);
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(ret, parsedFile, xhr);
delete _this2.reqs[uid];

@@ -309,3 +315,3 @@ },

var onError = _this2.props.onError;
onError === null || onError === void 0 ? void 0 : onError(err, ret, origin);
onError === null || onError === void 0 ? void 0 : onError(err, ret, parsedFile);
delete _this2.reqs[uid];

@@ -312,0 +318,0 @@ }

import React, { Component } from 'react';
import type { UploadProps, RcFile, BeforeUploadFileType } from './interface';
import type { UploadProps, RcFile } from './interface';
interface ParsedFileInfo {

@@ -7,3 +7,3 @@ origin: RcFile;

data: object;
parsedFile: Exclude<BeforeUploadFileType, boolean>;
parsedFile: RcFile;
}

@@ -10,0 +10,0 @@ declare class AjaxUploader extends Component<UploadProps> {

@@ -161,3 +161,3 @@ "use strict";

var _ref2 = (0, _asyncToGenerator2.default)( /*#__PURE__*/_regenerator.default.mark(function _callee(file, fileList) {
var beforeUpload, transformedFile, action, mergedAction, data, mergedData, parsedFile;
var beforeUpload, transformedFile, action, mergedAction, data, mergedData, parsedData, parsedFile, mergedParsedFile;
return _regenerator.default.wrap(function _callee$(_context) {

@@ -244,18 +244,24 @@ while (1) {

case 30:
parsedFile = // string type is from legacy `transformFile`.
parsedData = // string type is from legacy `transformFile`.
// Not sure if this will work since no related test case works with it
((0, _typeof2.default)(transformedFile) === 'object' || typeof transformedFile === 'string') && transformedFile ? transformedFile : file; // Used for `request.ts` get form data name
((0, _typeof2.default)(transformedFile) === 'object' || typeof transformedFile === 'string') && transformedFile ? transformedFile : file;
if ((0, _typeof2.default)(parsedFile) === 'object' && !parsedFile.name) {
parsedFile.name = file.name;
if (parsedData instanceof File) {
parsedFile = parsedData;
} else {
parsedFile = new File([parsedData], file.name, {
type: file.type
});
}
mergedParsedFile = parsedFile;
mergedParsedFile.uid = file.uid;
return _context.abrupt("return", {
origin: file,
data: mergedData,
parsedFile: parsedFile,
parsedFile: mergedParsedFile,
action: mergedAction
});
case 33:
case 35:
case "end":

@@ -324,7 +330,7 @@ return _context.stop();

var onProgress = _this2.props.onProgress;
onProgress === null || onProgress === void 0 ? void 0 : onProgress(e, origin);
onProgress === null || onProgress === void 0 ? void 0 : onProgress(e, parsedFile);
},
onSuccess: function onSuccess(ret, xhr) {
var onSuccess = _this2.props.onSuccess;
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(ret, origin, xhr);
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess(ret, parsedFile, xhr);
delete _this2.reqs[uid];

@@ -334,3 +340,3 @@ },

var onError = _this2.props.onError;
onError === null || onError === void 0 ? void 0 : onError(err, ret, origin);
onError === null || onError === void 0 ? void 0 : onError(err, ret, parsedFile);
delete _this2.reqs[uid];

@@ -337,0 +343,0 @@ }

{
"name": "rc-upload",
"version": "4.1.0",
"version": "4.2.0-alpha.0",
"description": "upload ui component for react",

@@ -5,0 +5,0 @@ "keywords": [

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