8000 @uppy/core: fix undefined reference when cancelling an upload by qxprakash · Pull Request #5730 · transloadit/uppy · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

@uppy/core: fix undefined reference when cancelling an upload #5730

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 24, 2025

Conversation

qxprakash
Copy link
Collaborator
@qxprakash qxprakash commented Apr 24, 2025

This fixes #5729

Before :

when you upload a large file and cancel it midway
you would see this error , and in some cases as encountered by @LukasHirt , emits a complete event with undefined payload , both the issues are related , and infact same

image

complete event is emitted with an undefined result value , which errors out in handleComplete event

This is happening because upon clicking the cancel button uppy.cancelAll() removeFiles is called which resets the currentUploads

which leads to currentUpload being undefined and result returned from #runUpload as undefined
and that result is sent with non null assertion in the 'complete' event

const uploadID = this.#createUpload(waitingFileIDs)
const result = await this.#runUpload(uploadID)
this.emit('complete', result!)
return result
})

all leading to this error

After :

in case of result == null , we send a default result object with empty succesfull and failed , arrays

image

Copy link
Contributor
Diff output files
diff --git a/packages/@uppy/core/lib/Uppy.js b/packages/@uppy/core/lib/Uppy.js
index e4bf6e8..614cd33 100644
--- a/packages/@uppy/core/lib/Uppy.js
+++ b/packages/@uppy/core/lib/Uppy.js
@@ -1598,6 +1598,11 @@ async function _runUpload2(uploadID) {
   }
   if (result == null) {
     this.log(`Not setting result for an upload that has been removed: ${uploadID}`);
+    result = {
+      successful: [],
+      failed: [],
+      uploadID,
+    };
   }
   return result;
 }

@qxprakash
Copy link
Collaborator Author

IMO this fixes another bug , when we cancelled upload , it should not be considered as failed one but the Status bar UI showed it as failed with retry button.

@Murderlon Murderlon changed the title return result object instead of undefined in case of cancelled uploads @uppy/core: fix undefined reference when cancelling an upload Apr 24, 2025
Copy link
Member
@Murderlon Murderlon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense, thanks for the fix!

@Murderlon Murderlon merged commit bb82326 into transloadit:main Apr 24, 2025
17 checks passed
Murderlon added a commit that referenced this pull request Apr 30, 2025
* main:
  @uppy/core: fix undefined reference when cancelling an upload (#5730)
  ts: make locale strings optional (#5728)
  Release: uppy@4.15.0 (#5720)
@github-actions github-actions bot mentioned this pull request May 18, 2025
github-actions bot added a commit that referenced this pull request May 18, 2025
| Package                    | Version | Package                    | Version |
| -------------------------- | ------- | -------------------------- | ------- |
| @uppy/audio                |   2.1.3 | @uppy/image-editor         |   3.3.3 |
| @uppy/box                  |   3.2.3 | @uppy/instagram            |   4.2.3 |
| @uppy/companion            |   5.7.0 | @uppy/onedrive             |   4.2.4 |
| @uppy/companion-client     |   4.4.2 | @uppy/remote-sources       |   2.3.3 |
| @uppy/core                 |   4.4.5 | @uppy/screen-capture       |   4.2.3 |
| @uppy/dashboard            |   4.3.4 | @uppy/unsplash             |   4.3.4 |
| @uppy/drag-drop            |   4.1.3 | @uppy/url                  |   4.2.4 |
| @uppy/dropbox              |   4.2.3 | @uppy/utils                |   6.1.4 |
| @uppy/facebook             |   4.2.3 | @uppy/webcam               |   4.1.3 |
| @uppy/file-input           |   4.1.3 | @uppy/webdav               |   0.3.3 |
| @uppy/google-drive         |   4.3.3 | @uppy/zoom                 |   3.2.3 |
| @uppy/google-drive-picker  |   0.3.5 | uppy                       |  4.16.0 |
| @uppy/google-photos-picker |   0.3.5 |                            |         |

- @uppy/companion-client: don't reject on incorrect origin (Mikael Finstad / #5736)
- @uppy/companion: implement credentials param `transloadit_gateway` (Mikael Finstad / #5725)
- @uppy/companion: Fix AES key wear-out (Florian Maury / #5724)
- @uppy/core: fix undefined reference when cancelling an upload (Prakash / #5730)
- @uppy/audio,@uppy/box,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/google-drive-picker,@uppy/google-drive,@uppy/google-photos-picker,@uppy/image-editor,@uppy/instagram,@uppy/onedrive,@uppy/remote-sources,@uppy/screen-capture,@uppy/unsplash,@uppy/url,@uppy/utils,@uppy/webcam,@uppy/webdav,@uppy/zoom: ts: make locale strings optional (Merlijn Vos / #5728)
@github-actions github-actions bot mentioned this pull request May 18, 2025
github-actions bot added a commit that referenced this pull request May 18, 2025
| Package                    | Version | Package                    | Version |
| -------------------------- | ------- | -------------------------- | ------- |
| @uppy/audio                |   2.1.3 | @uppy/image-editor         |   3.3.3 |
| @uppy/box                  |   3.2.3 | @uppy/instagram            |   4.2.3 |
| @uppy/companion            |   5.7.0 | @uppy/onedrive             |   4.2.4 |
| @uppy/companion-client     |   4.4.2 | @uppy/remote-sources       |   2.3.3 |
| @uppy/core                 |   4.4.5 | @uppy/screen-capture       |   4.2.3 |
| @uppy/dashboard            |   4.3.4 | @uppy/unsplash             |   4.3.4 |
| @uppy/drag-drop            |   4.1.3 | @uppy/url                  |   4.2.4 |
| @uppy/dropbox              |   4.2.3 | @uppy/utils                |   6.1.4 |
| @uppy/facebook             |   4.2.3 | @uppy/webcam               |   4.1.3 |
| @uppy/file-input           |   4.1.3 | @uppy/webdav               |   0.3.3 |
| @uppy/google-drive         |   4.3.3 | @uppy/zoom                 |   3.2.3 |
| @uppy/google-drive-picker  |   0.3.5 | uppy                       |  4.16.0 |
| @uppy/google-photos-picker |   0.3.5 |                            |         |

- meta: Revert "Release: uppy@4.16.0 (#5750)" (Mikael Finstad)
- meta: force cdn upload (Mikael Finstad)
- meta: fix invalid brach option (now ref) (Mikael Finstad)
- meta: improve release script output (Mikael Finstad)
- meta: fix error (Mikael Finstad)
- meta: Release: uppy@4.16.0 (github-actions[bot] / #5750)
- meta: Fix node versions (Mikael Finstad / #5740)
- @uppy/companion-client: don't reject on incorrect origin (Mikael Finstad / #5736)
- @uppy/companion: implement credentials param `transloadit_gateway` (Mikael Finstad / #5725)
- @uppy/companion: Fix AES key wear-out (Florian Maury / #5724)
- @uppy/core: fix undefined reference when cancelling an upload (Prakash / #5730)
- @uppy/audio,@uppy/box,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/google-drive-picker,@uppy/google-drive,@uppy/google-photos-picker,@uppy/image-editor,@uppy/instagram,@uppy/onedrive,@uppy/remote-sources,@uppy/screen-capture,@uppy/unsplash,@uppy/url,@uppy/utils,@uppy/webcam,@uppy/webdav,@uppy/zoom: ts: make locale strings optional (Merlijn Vos / #5728)
@github-actions github-actions bot mentioned this pull request May 18, 2025
github-actions bot added a commit that referenced this pull request May 18, 2025
| Package                    | Version | Package                    | Version |
| -------------------------- | ------- | -------------------------- | ------- |
| @uppy/audio                |   2.1.3 | @uppy/image-editor         |   3.3.3 |
| @uppy/box                  |   3.2.3 | @uppy/instagram            |   4.2.3 |
| @uppy/companion            |   5.7.0 | @uppy/onedrive             |   4.2.4 |
| @uppy/companion-client     |   4.4.2 | @uppy/remote-sources       |   2.3.3 |
| @uppy/core                 |   4.4.5 | @uppy/screen-capture       |   4.2.3 |
| @uppy/dashboard            |   4.3.4 | @uppy/unsplash             |   4.3.4 |
| @uppy/drag-drop            |   4.1.3 | @uppy/url                  |   4.2.4 |
| @uppy/dropbox             
8000
 |   4.2.3 | @uppy/utils                |   6.1.4 |
| @uppy/facebook             |   4.2.3 | @uppy/webcam               |   4.1.3 |
| @uppy/file-input           |   4.1.3 | @uppy/webdav               |   0.3.3 |
| @uppy/google-drive         |   4.3.3 | @uppy/zoom                 |   3.2.3 |
| @uppy/google-drive-picker  |   0.3.5 | uppy                       |  4.16.0 |
| @uppy/google-photos-picker |   0.3.5 |                            |         |

- meta: Revert "Release: uppy@4.16.0 (#5750)" (Mikael Finstad)
- meta: force cdn upload (Mikael Finstad)
- meta: fix invalid brach option (now ref) (Mikael Finstad)
- meta: improve release script output (Mikael Finstad)
- meta: fix error (Mikael Finstad)
- meta: Release: uppy@4.16.0 (github-actions[bot] / #5750)
- meta: Fix node versions (Mikael Finstad / #5740)
- @uppy/companion-client: don't reject on incorrect origin (Mikael Finstad / #5736)
- @uppy/companion: implement credentials param `transloadit_gateway` (Mikael Finstad / #5725)
- @uppy/companion: Fix AES key wear-out (Florian Maury / #5724)
- @uppy/core: fix undefined reference when cancelling an upload (Prakash / #5730)
- @uppy/audio,@uppy/box,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/google-drive-picker,@uppy/google-drive,@uppy/google-photos-picker,@uppy/image-editor,@uppy/instagram,@uppy/onedrive,@uppy/remote-sources,@uppy/screen-capture,@uppy/unsplash,@uppy/url,@uppy/utils,@uppy/webcam,@uppy/webdav,@uppy/zoom: ts: make locale strings optional (Merlijn Vos / #5728)
@github-actions github-actions bot mentioned this pull request May 18, 2025
github-actions bot added a commit that referenced this pull request May 18, 2025
| Package                    | Version | Package                    | Version |
| -------------------------- | ------- | -------------------------- | ------- |
| @uppy/audio                |   2.1.3 | @uppy/image-editor         |   3.3.3 |
| @uppy/box                  |   3.2.3 | @uppy/instagram            |   4.2.3 |
| @uppy/companion            |   5.7.0 | @uppy/onedrive             |   4.2.4 |
| @uppy/companion-client     |   4.4.2 | @uppy/remote-sources       |   2.3.3 |
| @uppy/core                 |   4.4.5 | @uppy/screen-capture       |   4.2.3 |
| @uppy/dashboard            |   4.3.4 | @uppy/unsplash             |   4.3.4 |
| @uppy/drag-drop            |   4.1.3 | @uppy/url                  |   4.2.4 |
| @uppy/dropbox              |   4.2.3 | @uppy/utils                |   6.1.4 |
| @uppy/facebook             |   4.2.3 | @uppy/webcam               |   4.1.3 |
| @uppy/file-input           |   4.1.3 | @uppy/webdav               |   0.3.3 |
| @uppy/google-drive         |   4.3.3 | @uppy/zoom                 |   3.2.3 |
| @uppy/google-drive-picker  |   0.3.5 | uppy                       |  4.16.0 |
| @uppy/google-photos-picker |   0.3.5 |                            |         |

- meta: Revert "Release: uppy@4.16.0 (#5750)" (Mikael Finstad)
- meta: force cdn upload (Mikael Finstad)
- meta: fix invalid brach option (now ref) (Mikael Finstad)
- meta: improve release script output (Mikael Finstad)
- meta: fix error (Mikael Finstad)
- meta: Release: uppy@4.16.0 (github-actions[bot] / #5750)
- meta: Fix node versions (Mikael Finstad / #5740)
- @uppy/companion-client: don't reject on incorrect origin (Mikael Finstad / #5736)
- @uppy/companion: implement credentials param `transloadit_gateway` (Mikael Finstad / #5725)
- @uppy/companion: Fix AES key wear-out (Florian Maury / #5724)
- @uppy/core: fix undefined reference when cancelling an upload (Prakash / #5730)
- @uppy/audio,@uppy/box,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/google-drive-picker,@uppy/google-drive,@uppy/google-photos-picker,@uppy/image-editor,@uppy/instagram,@uppy/onedrive,@uppy/remote-sources,@uppy/screen-capture,@uppy/unsplash,@uppy/url,@uppy/utils,@uppy/webcam,@uppy/webdav,@uppy/zoom: ts: make locale strings optional (Merlijn Vos / #5728)
@github-actions github-actions bot mentioned this pull request May 18, 2025
github-actions bot added a commit that referenced this pull request May 18, 2025
| Package                    | Version | Package                    | Version |
| -------------------------- | ------- | -------------------------- | ------- |
| @uppy/audio                |   2.1.3 | @uppy/image-editor         |   3.3.3 |
| @uppy/box                  |   3.2.3 | @uppy/instagram            |   4.2.3 |
| @uppy/companion            |   5.7.0 | @uppy/onedrive             |   4.2.4 |
| @uppy/companion-client     |   4.4.2 | @uppy/remote-sources       |   2.3.3 |
| @uppy/core                 |   4.4.5 | @uppy/screen-capture       |   4.2.3 |
| @uppy/dashboard            |   4.3.4 | @uppy/unsplash             |   4.3.4 |
| @uppy/drag-drop            |   4.1.3 | @uppy/url                  |   4.2.4 |
| @uppy/dropbox              |   4.2.3 | @uppy/utils                |   6.1.4 |
| @uppy/facebook             |   4.2.3 | @uppy/webcam               |   4.1.3 |
| @uppy/file-input           |   4.1.3 | @uppy/webdav               |   0.3.3 |
| @uppy/google-drive         |   4.3.3 | @uppy/zoom                 |   3.2.3 |
| @uppy/google-drive-picker  |   0.3.5 | uppy                       |  4.16.0 |
| @uppy/google-photos-picker |   0.3.5 |                            |         |

- meta: Revert "Release: uppy@4.16.0 (#5750)" (Mikael Finstad)
- meta: force cdn upload (Mikael Finstad)
- meta: fix invalid brach option (now ref) (Mikael Finstad)
- meta: improve release script output (Mikael Finstad)
- meta: fix error (Mikael Finstad)
- meta: Release: uppy@4.16.0 (github-actions[bot] / #5750)
- meta: Fix node versions (Mikael Finstad / #5740)
- @uppy/companion-client: don't reject on incorrect origin (Mikael Finstad / #5736)
- @uppy/companion: implement credentials param `transloadit_gateway` (Mikael Finstad / #5725)
- @uppy/companion: Fix AES key wear-out (Florian Maury / #5724)
- @uppy/core: fix undefined reference when cancelling an upload (Prakash / #5730)
- @uppy/audio,@uppy/box,@uppy/core,@uppy/dashboard,@uppy/drag-drop,@uppy/dropbox,@uppy/facebook,@uppy/file-input,@uppy/google-drive-picker,@uppy/google-drive,@uppy/google-photos-picker,@uppy/image-editor,@uppy/instagram,@uppy/onedrive,@uppy/remote-sources,@uppy/screen-capture,@uppy/unsplash,@uppy/url,@uppy/utils,@uppy/webcam,@uppy/webdav,@uppy/zoom: ts: make locale strings optional (Merlijn Vos / #5728)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

complete event is emitted with undefined payload when cancelling upload
2 participants
0