From 7853232eb9215932c72f6406e8ce974b5c2988f1 Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Sun, 12 Jan 2025 14:44:36 +0530 Subject: [PATCH 1/2] Fixed PDF console error on uploading --- .../AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx | 3 ++- src/components/Attachments/AttachmentView/index.tsx | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx b/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx index ae74a11c7e9d..0f28c4bb1bbf 100644 --- a/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx +++ b/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx @@ -58,13 +58,14 @@ function BaseAnchorForAttachmentsOnly({style, source = '', displayName = '', onP role={CONST.ROLE.BUTTON} > )} diff --git a/src/components/Attachments/AttachmentView/index.tsx b/src/components/Attachments/AttachmentView/index.tsx index 17596bea9af0..a692b62ac958 100644 --- a/src/components/Attachments/AttachmentView/index.tsx +++ b/src/components/Attachments/AttachmentView/index.tsx @@ -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) => { From dc9c42ecbb880d4dec77f23564f55733c9a28e3d Mon Sep 17 00:00:00 2001 From: Shubham Agrawal Date: Mon, 13 Jan 2025 09:48:02 +0530 Subject: [PATCH 2/2] Fix lint --- .../AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx b/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx index 0f28c4bb1bbf..42b3a1d8cfc3 100644 --- a/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx +++ b/src/components/AnchorForAttachmentsOnly/BaseAnchorForAttachmentsOnly.tsx @@ -51,7 +51,7 @@ 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}