diff --git a/src/file-actions.js b/src/file-actions.js index 4c33583821..76317a3df9 100644 --- a/src/file-actions.js +++ b/src/file-actions.js @@ -23,10 +23,15 @@ const openPdf = new FileAction({ { productName: getCapabilities().productName }) }, - enabled: () => { + enabled: (files) => { + if (files.length !== 1) { + return false + } + + const isPdf = files[0].mime === 'application/pdf' // Only enable the file action when files_pdfviewer is enabled const optionalMimetypes = getCapabilities().mimetypesNoDefaultOpen - return optionalMimetypes.includes('application/pdf') + return isPdf && optionalMimetypes.includes('application/pdf') }, exec: (file) => {