diff --git a/plugins/uploader-resources/src/components/FileUploadStatusBar.svelte b/plugins/uploader-resources/src/components/FileUploadStatusBar.svelte
index a7070e0df7..d3cfcdcada 100644
--- a/plugins/uploader-resources/src/components/FileUploadStatusBar.svelte
+++ b/plugins/uploader-resources/src/components/FileUploadStatusBar.svelte
@@ -65,7 +65,7 @@
class="container flex-row-center flex-gap-2 active"
class:error={state.error}
on:click={handleClick}
- use:tooltip={state.error !== undefined ? { label: getEmbeddedLabel(state.error) } : undefined}
+ use:tooltip={state.error != null ? { label: getEmbeddedLabel(state.error) } : undefined}
>
{#if state.error}
diff --git a/plugins/uploader-resources/src/uppy.ts b/plugins/uploader-resources/src/uppy.ts
index 8e197800ef..84a7316e2d 100644
--- a/plugins/uploader-resources/src/uppy.ts
+++ b/plugins/uploader-resources/src/uppy.ts
@@ -76,15 +76,19 @@ export function getUppy (options: FileUploadOptions, onFileUploaded?: FileUpload
method: 'POST',
headers: {
Authorization: 'Bearer ' + (getMetadata(presentation.metadata.Token) as string)
+ },
+ getResponseError: (_, response) => {
+ return new Error((response as Response).statusText)
}
- // getResponseData: (body: string): UppyBody => {
- // const data = JSON.parse(body)
- // return {
- // uuid: data[0].id
- // }
- // }
})
+ // Hack to setup shouldRetry callback on xhrUpload that is not exposed in options
+ const xhrUpload = uppy.getState().xhrUpload ?? {}
+ uppy.getState().xhrUpload = {
+ ...xhrUpload,
+ shouldRetry: (response: Response) => response.status !== 413
+ }
+
uppy.addPreProcessor(async (fileIds: string[]) => {
for (const fileId of fileIds) {
const file = uppy.getFile(fileId)
@@ -98,8 +102,12 @@ export function getUppy (options: FileUploadOptions, onFileUploaded?: FileUpload
if (onFileUploaded != null) {
uppy.addPostProcessor(async (fileIds: string[]) => {
- for (const fileId of fileIds) {
- const file = uppy.getFile(fileId)
+ // post-process only files without errors
+ const files = fileIds
+ .map((fileId) => uppy.getFile(fileId))
+ .filter((file) => !('error' in file && file.error != null))
+
+ for (const file of files) {
const uuid = file.meta.uuid as Ref
if (uuid !== undefined) {
const metadata = await getFileMetadata(file.data, uuid)