Skip to content

Commit cdc4c4a

Browse files
authored
Merge pull request #55133 from shubham1206agra/fix-pdf-error
Fixed PDF console error on uploading
2 parents b545bcf + dc9c42e commit cdc4c4a

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -51,20 +51,21 @@ function BaseAnchorForAttachmentsOnly({style, source = '', displayName = '', onP
5151
if (isDisabled) {
5252
return;
5353
}
54-
showContextMenuForReport(event, anchor, report?.reportID ?? '-1', action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report, reportNameValuePairs));
54+
showContextMenuForReport(event, anchor, report?.reportID, action, checkIfContextMenuActive, ReportUtils.isArchivedRoom(report, reportNameValuePairs));
5555
}}
5656
shouldUseHapticsOnLongPress
5757
accessibilityLabel={displayName}
5858
role={CONST.ROLE.BUTTON}
5959
>
6060
<AttachmentView
61-
source={sourceURLWithAuth}
61+
source={source}
6262
file={{name: displayName}}
6363
shouldShowDownloadIcon={!!sourceID && !isOffline}
6464
shouldShowLoadingSpinnerIcon={isDownloading}
6565
isUsedAsChatAttachment
6666
isDeleted={!!isDeleted}
6767
isUploading={!sourceID}
68+
isAuthTokenRequired={!!sourceID}
6869
/>
6970
</PressableWithoutFeedback>
7071
)}

src/components/Attachments/AttachmentView/index.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ function AttachmentView({
177177
// will appear with a source that is a blob
178178
const isSourcePDF = typeof source === 'string' && Str.isPDF(source);
179179
const isFilePDF = file && Str.isPDF(file.name ?? translate('attachmentView.unknownFilename'));
180-
if (!hasPDFFailedToLoad && (isSourcePDF || isFilePDF)) {
180+
if (!hasPDFFailedToLoad && !isUploading && (isSourcePDF || isFilePDF)) {
181181
const encryptedSourceUrl = isAuthTokenRequired ? addEncryptedAuthTokenToURL(source as string) : (source as string);
182182

183183
const onPDFLoadComplete = (path: string) => {

0 commit comments

Comments
 (0)