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]);