From b966be7f0d622d128ba79b96d86e49c64052cbe4 Mon Sep 17 00:00:00 2001 From: nfebe Date: Thu, 19 Mar 2026 18:37:22 +0100 Subject: [PATCH] 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 --- src/file-actions.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/file-actions.js b/src/file-actions.js index 2686352d94..34395cec90 100644 --- a/src/file-actions.js +++ b/src/file-actions.js @@ -2,7 +2,7 @@ * SPDX-FileCopyrightText: 2024 Nextcloud GmbH and Nextcloud contributors * SPDX-License-Identifier: AGPL-3.0-or-later */ -import { registerFileAction } from '@nextcloud/files' +import { Permission, registerFileAction } from '@nextcloud/files' import { getCapabilities } from './services/capabilities.ts' import { translate as t } from '@nextcloud/l10n' @@ -28,6 +28,10 @@ const openPdf = { return false } + if ((nodes[0].permissions & Permission.READ) === 0) { + return false + } + const isPdf = nodes[0].mime === 'application/pdf' // Only enable the file action when files_pdfviewer is enabled const optionalMimetypes = getCapabilities().mimetypesNoDefaultOpen