Skip to content

Commit

Permalink
Merge pull request #4231 from nextcloud/fix/collabora-file-action-lim…
Browse files Browse the repository at this point in the history
…it-pdf

fix: Limit open with Collabora action to pdf files
  • Loading branch information
elzody authored Nov 15, 2024
2 parents e8d82c5 + 94ac7b7 commit 96d0bcf
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 96d0bcf

Please sign in to comment.