From d135d4bdcd50254961d4fb8b3eaaaec81381291c Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Tue, 17 Oct 2023 12:56:14 +0800 Subject: [PATCH 1/2] don't set auth token if it's a local file --- .../AttachmentCarousel/extractAttachmentsFromReport.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js b/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js index 8a623a44709..f5d9618de85 100644 --- a/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js +++ b/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js @@ -54,9 +54,10 @@ function extractAttachmentsFromReport(report, reportActions) { const transaction = TransactionUtils.getTransaction(transactionID); if (TransactionUtils.hasReceipt(transaction)) { const {image} = ReceiptUtils.getThumbnailAndImageURIs(transaction.receipt.source, transaction.filename); + const isLocalFile = image.startsWith('blob:') || image.startsWith('file:'); attachments.unshift({ source: tryResolveUrlFromApiRoot(image), - isAuthTokenRequired: true, + isAuthTokenRequired: !isLocalFile, file: {name: transaction.filename}, isReceipt: true, transactionID, From ac5ad67bd5d41e2700dee875c992fdc39b62b62d Mon Sep 17 00:00:00 2001 From: Bernhard Owen Josephus Date: Wed, 18 Oct 2023 11:29:50 +0800 Subject: [PATCH 2/2] check if it's string --- .../AttachmentCarousel/extractAttachmentsFromReport.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js b/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js index 594bf197ad8..8420a9e7831 100644 --- a/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js +++ b/src/components/Attachments/AttachmentCarousel/extractAttachmentsFromReport.js @@ -54,7 +54,7 @@ function extractAttachmentsFromReport(report, reportActions) { const transaction = TransactionUtils.getTransaction(transactionID); if (TransactionUtils.hasReceipt(transaction)) { const {image} = ReceiptUtils.getThumbnailAndImageURIs(transaction); - const isLocalFile = image.startsWith('blob:') || image.startsWith('file:'); + const isLocalFile = typeof image === 'string' && (image.startsWith('blob:') || image.startsWith('file:')); attachments.unshift({ source: tryResolveUrlFromApiRoot(image), isAuthTokenRequired: !isLocalFile,