Skip to content

Commit

Permalink
Merge pull request #34030 from namhihi237/fix-crash-attachment
Browse files Browse the repository at this point in the history
fix crash attachment

(cherry picked from commit cfdd159)
  • Loading branch information
thienlnam authored and OSBotify committed Jan 8, 2024
1 parent c194075 commit 6d0f75d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -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));
Expand Down Expand Up @@ -359,7 +359,7 @@ function AttachmentModal(props) {
}, []);

useEffect(() => {
setSource(props.source);
setSource(() => props.source);
}, [props.source]);

useEffect(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/libs/ReceiptUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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.startsWith('/');
return {thumbnail: image, image: path, isLocalFile};
}

Expand Down

0 comments on commit 6d0f75d

Please sign in to comment.