Skip to content

Commit

Permalink
Merge pull request #55133 from shubham1206agra/fix-pdf-error
Browse files Browse the repository at this point in the history
Fixed PDF console error on uploading
  • Loading branch information
mjasikowski authored Jan 13, 2025
2 parents b545bcf + dc9c42e commit cdc4c4a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,20 +51,21 @@ function BaseAnchorForAttachmentsOnly({style, source = '', displayName = '', onP
if (isDisabled) {
return;
}
showContextMenuForReport(event, anchor, report?.reportID ?? '-1', action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report, reportNameValuePairs));
showContextMenuForReport(event, anchor, report?.reportID, action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report, reportNameValuePairs));
}}
shouldUseHapticsOnLongPress
accessibilityLabel={displayName}
role={CONST.ROLE.BUTTON}
>
<AttachmentView
source={sourceURLWithAuth}
source={source}
file={{name: displayName}}
shouldShowDownloadIcon={!!sourceID && !isOffline}
shouldShowLoadingSpinnerIcon={isDownloading}
isUsedAsChatAttachment
isDeleted={!!isDeleted}
isUploading={!sourceID}
isAuthTokenRequired={!!sourceID}
/>
</PressableWithoutFeedback>
)}
Expand Down
2 changes: 1 addition & 1 deletion src/components/Attachments/AttachmentView/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ function AttachmentView({
// will appear with a source that is a blob
const isSourcePDF = typeof source === 'string' && Str.isPDF(source);
const isFilePDF = file && Str.isPDF(file.name ?? translate('attachmentView.unknownFilename'));
if (!hasPDFFailedToLoad && (isSourcePDF || isFilePDF)) {
if (!hasPDFFailedToLoad && !isUploading && (isSourcePDF || isFilePDF)) {
const encryptedSourceUrl = isAuthTokenRequired ? addEncryptedAuthTokenToURL(source as string) : (source as string);

const onPDFLoadComplete = (path: string) => {
Expand Down

0 comments on commit cdc4c4a

Please sign in to comment.