From 29732647bc510d1a62b7457f50ec44227c50f3a0 Mon Sep 17 00:00:00 2001 From: Carlos Martins Date: Thu, 19 Sep 2024 07:47:53 +0900 Subject: [PATCH 1/2] fix log calls --- .../SelectionList/Search/TransactionListItemRow.tsx | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/components/SelectionList/Search/TransactionListItemRow.tsx b/src/components/SelectionList/Search/TransactionListItemRow.tsx index 4a59b58a8273..f19105bd56dd 100644 --- a/src/components/SelectionList/Search/TransactionListItemRow.tsx +++ b/src/components/SelectionList/Search/TransactionListItemRow.tsx @@ -81,10 +81,13 @@ function ReceiptCell({transactionItem}: TransactionCellProps) { const backgroundStyles = transactionItem.isSelected ? StyleUtils.getBackgroundColorStyle(theme.buttonHoveredBG) : StyleUtils.getBackgroundColorStyle(theme.border); - const filename = getFileName(transactionItem?.receipt?.source ?? ''); - const receiptURIs = getThumbnailAndImageURIs(transactionItem, null, filename); - const isReceiptPDF = Str.isPDF(filename); - const source = tryResolveUrlFromApiRoot(isReceiptPDF && !receiptURIs.isLocalFile ? receiptURIs.thumbnail ?? '' : receiptURIs.image ?? ''); + let source = transactionItem?.receipt?.source ?? ''; + if (source) { + const filename = getFileName(transactionItem?.receipt?.source ?? ''); + const receiptURIs = getThumbnailAndImageURIs(transactionItem, null, filename); + const isReceiptPDF = Str.isPDF(filename); + source = tryResolveUrlFromApiRoot(isReceiptPDF && !receiptURIs.isLocalFile ? receiptURIs.thumbnail ?? '' : receiptURIs.image ?? ''); + } return ( Date: Thu, 19 Sep 2024 07:51:51 +0900 Subject: [PATCH 2/2] reuse variable --- src/components/SelectionList/Search/TransactionListItemRow.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/SelectionList/Search/TransactionListItemRow.tsx b/src/components/SelectionList/Search/TransactionListItemRow.tsx index f19105bd56dd..7804ffa047f4 100644 --- a/src/components/SelectionList/Search/TransactionListItemRow.tsx +++ b/src/components/SelectionList/Search/TransactionListItemRow.tsx @@ -83,7 +83,7 @@ function ReceiptCell({transactionItem}: TransactionCellProps) { let source = transactionItem?.receipt?.source ?? ''; if (source) { - const filename = getFileName(transactionItem?.receipt?.source ?? ''); + const filename = getFileName(source); const receiptURIs = getThumbnailAndImageURIs(transactionItem, null, filename); const isReceiptPDF = Str.isPDF(filename); source = tryResolveUrlFromApiRoot(isReceiptPDF && !receiptURIs.isLocalFile ? receiptURIs.thumbnail ?? '' : receiptURIs.image ?? '');