Skip to content

Commit

Permalink
fix: Limit open with Collabora action to pdf files
Browse files Browse the repository at this point in the history
Signed-off-by: Julius Knorr <jus@bitgrid.net>
  • Loading branch information
juliusknorr committed Nov 15, 2024
1 parent b2f27f4 commit 94ac7b7
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/file-actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) => {
Expand Down

0 comments on commit 94ac7b7

Please sign in to comment.