Skip to content

Commit

Permalink
aws-s3: fix incorrect comparison for file-removed (#3962)
Browse files Browse the repository at this point in the history
Add check for file object vs file id
  • Loading branch information
Murderlon committed Aug 18, 2022
1 parent e69d4ec commit 222c00b
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions packages/@uppy/aws-s3/src/MiniXHRUpload.js
Expand Up @@ -100,8 +100,12 @@ export default class MiniXHRUpload {
}

#addEventHandlerForFile (eventName, fileID, eventHandler) {
this.uploaderEvents[fileID].on(eventName, (targetFileID) => {
if (fileID === targetFileID) eventHandler()
this.uploaderEvents[fileID].on(eventName, (fileOrID) => {
// TODO (major): refactor Uppy events to consistently send file objects (or consistently IDs)
// We created a generic `addEventListenerForFile` but not all events
// use file IDs, some use files, so we need to do this weird check.
const id = fileOrID?.id ?? fileOrID
if (fileID === id) eventHandler()
})
}

Expand Down

0 comments on commit 222c00b

Please sign in to comment.