Skip to content

Commit

Permalink
Merge pull request Expensify#33586 from namhihi237/fix/33412-loading-pdf
Browse files Browse the repository at this point in the history
fix loading pdf failed
  • Loading branch information
MonilBhavsar authored Jan 3, 2024
2 parents 53afb94 + 494d5fd commit 446ceb1
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/components/AttachmentModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ function AttachmentModal(props) {
setIsAuthTokenRequired(props.isAuthTokenRequired);
}, [props.isAuthTokenRequired]);

const sourceForAttachmentView = props.source || source;
const sourceForAttachmentView = source || props.source;

const threeDotsMenuItems = useMemo(() => {
if (!props.isReceiptAttachment || !props.parentReport || !props.parentReportActions) {
Expand Down
3 changes: 2 additions & 1 deletion src/components/ReportActionItem/ReportActionItemImage.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import Str from 'expensify-common/lib/str';
import PropTypes from 'prop-types';
import React from 'react';
import {View} from 'react-native';
Expand Down Expand Up @@ -60,7 +61,7 @@ function ReportActionItemImage({thumbnail, image, enablePreviewModal, transactio
<EReceiptThumbnail transactionID={transaction.transactionID} />
</View>
);
} else if (thumbnail && !isLocalFile) {
} else if (thumbnail && !isLocalFile && !Str.isPDF(imageSource)) {
receiptImageComponent = (
<ThumbnailImage
previewSourceURL={thumbnailSource}
Expand Down
3 changes: 2 additions & 1 deletion src/libs/ReceiptUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ function getThumbnailAndImageURIs(transaction: Transaction, receiptPath: string
image = ReceiptSVG;
}

return {thumbnail: image, image: path, isLocalFile: true};
const isLocalFile = path.startsWith('blob:') || path.startsWith('file:');
return {thumbnail: image, image: path, isLocalFile};
}

// eslint-disable-next-line import/prefer-default-export
Expand Down

0 comments on commit 446ceb1

Please sign in to comment.