@uppy/transloadit
Advanced tools
Comparing version 3.1.4 to 3.1.5
# @uppy/transloadit | ||
## 3.1.5 | ||
Released: 2023-05-15 | ||
Included in: Uppy v3.9.1 | ||
- @uppy/transloadit: clean up event listener to prevent cancelled assemblies (Merlijn Vos / #4447) | ||
## 3.1.4 | ||
@@ -4,0 +11,0 @@ |
@@ -18,3 +18,3 @@ function _classPrivateFieldLooseBase(receiver, privateKey) { if (!Object.prototype.hasOwnProperty.call(receiver, privateKey)) { throw new TypeError("attempted to use private field on non-instance"); } return receiver; } | ||
const packageJson = { | ||
"version": "3.1.4" | ||
"version": "3.1.5" | ||
}; | ||
@@ -749,8 +749,19 @@ | ||
} | ||
}); | ||
}); // TODO: this should not live inside a `file-removed` event but somewhere more deterministic. | ||
// Such as inside the function where the assembly has succeeded or cancelled. | ||
// For the use case of cancelling the assembly when needed, we should try to do that with just `cancel-all`. | ||
const fileRemovedHandler = (fileRemoved, reason) => { | ||
var _assembly$status; | ||
// If the assembly has successfully completed, we do not need these checks. | ||
// Otherwise we may cancel an assembly after it already succeeded | ||
if (((_assembly$status = assembly.status) == null ? void 0 : _assembly$status.ok) === 'ASSEMBLY_COMPLETED') { | ||
this.uppy.off('file-removed', fileRemovedHandler); | ||
return; | ||
} | ||
if (reason === 'cancel-all') { | ||
assembly.close(); | ||
this.uppy.off(fileRemovedHandler); | ||
this.uppy.off('file-removed', fileRemovedHandler); | ||
} else if (fileRemoved.id in updatedFiles) { | ||
@@ -767,3 +778,3 @@ delete updatedFiles[fileRemoved.id]; | ||
this.uppy.off(fileRemovedHandler); | ||
this.uppy.off('file-removed', fileRemovedHandler); | ||
} else { | ||
@@ -770,0 +781,0 @@ this.client.updateNumberOfFilesInAssembly(newAssembly, nbOfRemainingFiles).catch(() => { |
{ | ||
"name": "@uppy/transloadit", | ||
"description": "The Transloadit plugin can be used to upload files to Transloadit for all kinds of processing, such as transcoding video, resizing images, zipping/unzipping, and more", | ||
"version": "3.1.4", | ||
"version": "3.1.5", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
@@ -244,6 +244,15 @@ import hasProperty from '@uppy/utils/lib/hasProperty' | ||
// TODO: this should not live inside a `file-removed` event but somewhere more deterministic. | ||
// Such as inside the function where the assembly has succeeded or cancelled. | ||
// For the use case of cancelling the assembly when needed, we should try to do that with just `cancel-all`. | ||
const fileRemovedHandler = (fileRemoved, reason) => { | ||
// If the assembly has successfully completed, we do not need these checks. | ||
// Otherwise we may cancel an assembly after it already succeeded | ||
if (assembly.status?.ok === 'ASSEMBLY_COMPLETED') { | ||
this.uppy.off('file-removed', fileRemovedHandler) | ||
return | ||
} | ||
if (reason === 'cancel-all') { | ||
assembly.close() | ||
this.uppy.off(fileRemovedHandler) | ||
this.uppy.off('file-removed', fileRemovedHandler) | ||
} else if (fileRemoved.id in updatedFiles) { | ||
@@ -255,3 +264,3 @@ delete updatedFiles[fileRemoved.id] | ||
this.#cancelAssembly(newAssembly).catch(() => { /* ignore potential errors */ }) | ||
this.uppy.off(fileRemovedHandler) | ||
this.uppy.off('file-removed', fileRemovedHandler) | ||
} else { | ||
@@ -258,0 +267,0 @@ this.client.updateNumberOfFilesInAssembly(newAssembly, nbOfRemainingFiles) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
242394
3671