Skip to content

Commit

Permalink
Merge pull request #4232 from nextcloud/backport/4231/stable28
Browse files Browse the repository at this point in the history
[stable28] fix: Limit open with Collabora action to pdf files
  • Loading branch information
juliusknorr authored Nov 21, 2024
2 parents 2eb855b + d6e2dbd commit 3eb4360
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 @@ -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) => {
Expand Down

0 comments on commit 3eb4360

Please sign in to comment.