From 69ee750245bf667b8f07f496532a71b368f701fd Mon Sep 17 00:00:00 2001 From: Mattermost Build Date: Sun, 24 Oct 2021 21:59:55 +0200 Subject: [PATCH] Fix iOS paste screenshot (#5785) (#5787) (cherry picked from commit dd866ffeb814685bdbc9191830ba1a980548190d) Co-authored-by: Elias Nahum --- app/components/post_draft/uploads/uploads.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/components/post_draft/uploads/uploads.js b/app/components/post_draft/uploads/uploads.js index eebbc4533..3d1918cad 100644 --- a/app/components/post_draft/uploads/uploads.js +++ b/app/components/post_draft/uploads/uploads.js @@ -213,10 +213,16 @@ export default class Uploads extends PureComponent { let exceed = false; + const uploadFiles = []; const totalFiles = files.length; let i = 0; while (i < totalFiles) { const file = files[i]; + if (file.error) { + i++; + continue; + } + if (!file.fileSize | !file.fileName) { const path = (file.path || file.uri).replace('file://', ''); // eslint-disable-next-line no-await-in-loop @@ -229,6 +235,7 @@ export default class Uploads extends PureComponent { exceed = true; break; } + uploadFiles.push(file); i++; } @@ -236,7 +243,7 @@ export default class Uploads extends PureComponent { if (exceed) { this.handleFileSizeWarning(); } else { - this.props.initUploadFiles(files, this.props.rootId); + this.props.initUploadFiles(uploadFiles, this.props.rootId); this.hideError(); } };