From 295ae98916189c4920ab53903b94f4953fde68c9 Mon Sep 17 00:00:00 2001 From: Nam Le Date: Fri, 5 Jan 2024 22:12:59 +0700 Subject: [PATCH 1/2] fix set source and check local file --- src/components/AttachmentModal.js | 4 ++-- src/libs/ReceiptUtils.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/components/AttachmentModal.js b/src/components/AttachmentModal.js index d24d1e18907f..aa6c16798ccd 100755 --- a/src/components/AttachmentModal.js +++ b/src/components/AttachmentModal.js @@ -126,7 +126,7 @@ function AttachmentModal(props) { const [isAuthTokenRequired, setIsAuthTokenRequired] = useState(props.isAuthTokenRequired); const [attachmentInvalidReasonTitle, setAttachmentInvalidReasonTitle] = useState(''); const [attachmentInvalidReason, setAttachmentInvalidReason] = useState(null); - const [source, setSource] = useState(props.source); + const [source, setSource] = useState(() => props.source); const [modalType, setModalType] = useState(CONST.MODAL.MODAL_TYPE.CENTERED_UNSWIPEABLE); const [isConfirmButtonDisabled, setIsConfirmButtonDisabled] = useState(false); const [confirmButtonFadeAnimation] = useState(() => new Animated.Value(1)); @@ -359,7 +359,7 @@ function AttachmentModal(props) { }, []); useEffect(() => { - setSource(props.source); + setSource(() => props.source); }, [props.source]); useEffect(() => { diff --git a/src/libs/ReceiptUtils.ts b/src/libs/ReceiptUtils.ts index 1adb5957587b..d2fddf87670c 100644 --- a/src/libs/ReceiptUtils.ts +++ b/src/libs/ReceiptUtils.ts @@ -66,7 +66,7 @@ function getThumbnailAndImageURIs(transaction: Transaction, receiptPath: string image = ReceiptSVG; } - const isLocalFile = typeof path === 'number' || path.startsWith('blob:') || path.startsWith('file:'); + const isLocalFile = typeof path === 'number' || path.startsWith('blob:') || path.startsWith('file:') || path === ReceiptGeneric; return {thumbnail: image, image: path, isLocalFile}; } From d9e75d5b1eab9525d83facd34370a4fe21bee374 Mon Sep 17 00:00:00 2001 From: Nam Le Date: Mon, 8 Jan 2024 10:48:07 +0700 Subject: [PATCH 2/2] fix condition check assets web --- src/libs/ReceiptUtils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/ReceiptUtils.ts b/src/libs/ReceiptUtils.ts index d2fddf87670c..bcba68a3a0bd 100644 --- a/src/libs/ReceiptUtils.ts +++ b/src/libs/ReceiptUtils.ts @@ -66,7 +66,7 @@ function getThumbnailAndImageURIs(transaction: Transaction, receiptPath: string image = ReceiptSVG; } - const isLocalFile = typeof path === 'number' || path.startsWith('blob:') || path.startsWith('file:') || path === ReceiptGeneric; + const isLocalFile = typeof path === 'number' || path.startsWith('blob:') || path.startsWith('file:') || path.startsWith('/'); return {thumbnail: image, image: path, isLocalFile}; }