From 7079c4883262b98c8dca80b133a9700f40111af5 Mon Sep 17 00:00:00 2001 From: mkhutornyi Date: Mon, 6 Nov 2023 19:27:04 +0100 Subject: [PATCH] fix crash when trying to download a receipt while in scanning process --- src/components/AttachmentModal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index 8231dd7c4fe2..6c92e2cf29bb 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -191,7 +191,7 @@ function AttachmentModal(props) { sourceURL = addEncryptedAuthTokenToURL(sourceURL); } - fileDownload(sourceURL, file.name); + fileDownload(sourceURL, lodashGet(file, 'name', '')); // At ios, if the keyboard is open while opening the attachment, then after downloading // the attachment keyboard will show up. So, to fix it we need to dismiss the keyboard. @@ -391,7 +391,7 @@ function AttachmentModal(props) { } return menuItems; // eslint-disable-next-line react-hooks/exhaustive-deps - }, [isAttachmentReceipt, props.parentReport, props.parentReportActions, props.policy, props.transaction]); + }, [isAttachmentReceipt, props.parentReport, props.parentReportActions, props.policy, props.transaction, file]); return ( <>