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

@uppy/core

Package Overview
Dependencies
Maintainers
5
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uppy/core - npm Package Compare versions

Comparing version 3.11.3 to 3.12.0

8

CHANGELOG.md
# @uppy/core
## 3.12.0
Released: 2024-06-04
Included in: Uppy v3.26.0
- @uppy/core: check capabilities in clearUploadedFiles (Merlijn Vos / #5201)
- @uppy/core: PartialTree - change the `maxTotalFileSize` error (Evgenia Karunus / #5203)
## 3.11.3

@@ -4,0 +12,0 @@

1

lib/locale.js

@@ -15,2 +15,3 @@ export default {

},
aggregateExceedsSize: 'You selected %{size} of files, but maximum allowed size is %{sizeAllowed}',
exceedsSize: '%{file} exceeds maximum allowed size of %{size}',

@@ -17,0 +18,0 @@ missingRequiredMetaField: 'Missing required meta fields',

18

lib/Restricter.js

@@ -59,17 +59,11 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */

if (maxTotalFileSize) {
let totalFilesSize = existingFiles.reduce((total, f) => {
const totalFilesSize = [...existingFiles, ...addingFiles].reduce((total, f) => {
var _f$size;
return total + ((_f$size = f.size) != null ? _f$size : 0);
}, 0);
for (const addingFile of addingFiles) {
if (addingFile.size != null) {
// We can't check maxTotalFileSize if the size is unknown.
totalFilesSize += addingFile.size;
if (totalFilesSize > maxTotalFileSize) {
throw new RestrictionError(this.getI18n()('exceedsSize', {
size: prettierBytes(maxTotalFileSize),
file: addingFile.name
}));
}
}
if (totalFilesSize > maxTotalFileSize) {
throw new RestrictionError(this.getI18n()('aggregateExceedsSize', {
sizeAllowed: prettierBytes(maxTotalFileSize),
size: prettierBytes(totalFilesSize)
}));
}

@@ -76,0 +70,0 @@ }

@@ -27,3 +27,3 @@ let _Symbol$for, _Symbol$for2;

const packageJson = {
"version": "3.11.3"
"version": "3.12.0"
};

@@ -446,2 +446,9 @@ import locale from "./locale.js";

clearUploadedFiles() {
const {
capabilities,
currentUploads
} = this.getState();
if (Object.keys(currentUploads).length > 0 && !capabilities.individualCancellation) {
throw new Error('The installed uploader plugin does not allow removing files during an upload.');
}
this.setState({

@@ -739,3 +746,3 @@ ...defaultUploadState,

if (newFileIDs.length !== currentUploads[uploadID].fileIDs.length && !capabilities.individualCancellation) {
throw new Error('individualCancellation is disabled');
throw new Error('The installed uploader plugin does not allow removing files during an upload.');
}

@@ -742,0 +749,0 @@ updatedUploads[uploadID] = {

{
"name": "@uppy/core",
"description": "Core module for the extensible JavaScript file upload widget with support for drag&drop, resumable uploads, previews, restrictions, file processing/encoding, remote providers like Instagram, Dropbox, Google Drive, S3 and more :dog:",
"version": "3.11.3",
"version": "3.12.0",
"license": "MIT",

@@ -6,0 +6,0 @@ "main": "lib/index.js",

@@ -15,2 +15,4 @@ export default {

},
aggregateExceedsSize:
'You selected %{size} of files, but maximum allowed size is %{sizeAllowed}',
exceedsSize: '%{file} exceeds maximum allowed size of %{size}',

@@ -17,0 +19,0 @@ missingRequiredMetaField: 'Missing required meta fields',

@@ -101,21 +101,13 @@ /* eslint-disable @typescript-eslint/ban-ts-comment */

if (maxTotalFileSize) {
let totalFilesSize = existingFiles.reduce(
(total, f) => (total + (f.size ?? 0)) as number,
const totalFilesSize = [...existingFiles, ...addingFiles].reduce(
(total, f) => total + (f.size ?? 0),
0,
)
for (const addingFile of addingFiles) {
if (addingFile.size != null) {
// We can't check maxTotalFileSize if the size is unknown.
totalFilesSize += addingFile.size
if (totalFilesSize > maxTotalFileSize) {
throw new RestrictionError(
this.getI18n()('exceedsSize', {
size: prettierBytes(maxTotalFileSize),
file: addingFile.name,
}),
)
}
}
if (totalFilesSize > maxTotalFileSize) {
throw new RestrictionError(
this.getI18n()('aggregateExceedsSize', {
sizeAllowed: prettierBytes(maxTotalFileSize),
size: prettierBytes(totalFilesSize),
}),
)
}

@@ -122,0 +114,0 @@ }

@@ -8,2 +8,3 @@ /* eslint-disable */

| 'youHaveToAtLeastSelectX'
| 'aggregateExceedsSize'
| 'exceedsSize'

@@ -10,0 +11,0 @@ | 'missingRequiredMetaField'

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is too big to display

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