Skip to content

Commit e5ff4a8

Browse files
juliusknorrbackportbot[bot]
authored andcommitted
fix: Limit open with Collabora action to pdf files
Signed-off-by: Julius Knorr <[email protected]>
1 parent 0474aef commit e5ff4a8

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

src/file-actions.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,15 @@ const openPdf = new FileAction({
2323
{ productName: getCapabilities().productName })
2424
},
2525

26-
enabled: () => {
26+
enabled: (files) => {
27+
if (files.length !== 1) {
28+
return false
29+
}
30+
31+
const isPdf = files[0].mime === 'application/pdf'
2732
// Only enable the file action when files_pdfviewer is enabled
2833
const optionalMimetypes = getCapabilities().mimetypesNoDefaultOpen
29-
return optionalMimetypes.includes('application/pdf')
34+
return isPdf && optionalMimetypes.includes('application/pdf')
3035
},
3136

3237
exec: (file) => {

0 commit comments

Comments
 (0)