From 85d6915bad5fee81fe122477f23537a0054285a7 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Sun, 27 Jul 2025 18:05:49 +0800 Subject: [PATCH] use alertOnlyPDFSupported for document files (#9023) --- app/components/document/index.tsx | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app/components/document/index.tsx b/app/components/document/index.tsx index 4a5c5ceea..06fa8f81e 100644 --- a/app/components/document/index.tsx +++ b/app/components/document/index.tsx @@ -4,7 +4,7 @@ import {forwardRef, useImperativeHandle, type ReactNode, useCallback} from 'react'; import {useIntl} from 'react-intl'; -import {alertDownloadDocumentDisabled} from '@utils/document'; +import {alertDownloadDocumentDisabled, alertOnlyPDFSupported} from '@utils/document'; import {isPdf} from '@utils/file'; export type DocumentRef = { @@ -23,11 +23,16 @@ const Document = forwardRef(({canDownloadFiles, chil const intl = useIntl(); const handlePreviewPress = useCallback(async () => { - if (!canDownloadFiles || (enableSecureFilePreview && !isPdf(file))) { + if (!canDownloadFiles) { alertDownloadDocumentDisabled(intl); return; } + if (enableSecureFilePreview && !isPdf(file)) { + alertOnlyPDFSupported(intl); + return; + } + downloadAndPreviewFile(file); }, [canDownloadFiles, enableSecureFilePreview, downloadAndPreviewFile, file, intl]);