Skip to content

Commit 180da5b

Browse files
nfebeelzody
authored andcommitted
fix(files): Check read permission before showing PDF edit action
The "Edit with Collabora" file action was displayed for files the user lacks permission to access. Added a Permission.READ check in the enabled callback, consistent with how core Nextcloud file actions gate on node permissions. Signed-off-by: nfebe <fenn25.fn@gmail.com>
1 parent e0fd59d commit 180da5b

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/file-actions.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors
33
* SPDX-License-Identifier: AGPL-3.0-or-later
44
*/
5-
import { registerFileAction } from '@nextcloud/files'
5+
import { Permission, registerFileAction } from '@nextcloud/files'
66
import { getCapabilities } from './services/capabilities.ts'
77
import { translate as t } from '@nextcloud/l10n'
88

@@ -28,6 +28,10 @@ const openPdf = {
2828
return false
2929
}
3030

31+
if ((nodes[0].permissions & Permission.READ) === 0) {
32+
return false
33+
}
34+
3135
const isPdf = nodes[0].mime === 'application/pdf'
3236
// Only enable the file action when files_pdfviewer is enabled
3337
const optionalMimetypes = getCapabilities().mimetypesNoDefaultOpen

0 commit comments

Comments
 (0)