From eb4ad958c1438b8bd1cb8279bd82c75160769186 Mon Sep 17 00:00:00 2001 From: Dan Ungureanu Date: Tue, 18 Jan 2022 13:44:02 +0200 Subject: [PATCH] FIX: Ensure method exists before calling (#15632) `_perFileData` is not always defined and uploads failed when it is not. --- .../javascripts/discourse/app/mixins/uppy-upload.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js index f536fb16c9a..aaf6b4ec995 100644 --- a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js +++ b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js @@ -133,9 +133,11 @@ export default Mixin.create(UppyS3Multipart, { return false; } - Object.values(files).forEach((file) => { - deepMerge(file.meta, this._perFileData()); - }); + if (this._perFileData) { + Object.values(files).forEach((file) => { + deepMerge(file.meta, this._perFileData()); + }); + } }, });