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
  • Loading branch information
thienlnam authored Jan 8, 2024
2 parents 26b4006 + d9e75d5 commit cfdd159
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 @@ -129,7 +129,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 @@ -362,7 +362,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 cfdd159

Please sign in to comment.