From d6e2dbd649564051055e721894aa4bca55cd18a4 Mon Sep 17 00:00:00 2001 From: Julius Knorr Date: Fri, 15 Nov 2024 08:54:41 +0100 Subject: [PATCH] fix: Limit open with Collabora action to pdf files Signed-off-by: Julius Knorr --- src/file-actions.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/file-actions.js b/src/file-actions.js index 19e4033cfa..fba1e1bdfb 100644 --- a/src/file-actions.js +++ b/src/file-actions.js @@ -21,10 +21,15 @@ const openPdf = new FileAction({ { productName: richdocuments.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 = richdocuments.mimetypesNoDefaultOpen - return optionalMimetypes.includes('application/pdf') + return isPdf && optionalMimetypes.includes('application/pdf') }, exec: (file) => {