Merge pull request #59865 from nextcloud/backport/59850/stable33

[stable33] fix(files): do not show convert-file action in view-only shares
This commit is contained in:
Ferdinand Thiessen 2026-04-23 06:25:02 +02:00 committed by GitHub
commit b25e7b8d70
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 5 deletions

View file

@ -7,9 +7,10 @@ import type { IFileAction } from '@nextcloud/files'
import AutoRenewSvg from '@mdi/svg/svg/autorenew.svg?raw'
import { getCapabilities } from '@nextcloud/capabilities'
import { registerFileAction } from '@nextcloud/files'
import { Permission, registerFileAction } from '@nextcloud/files'
import { t } from '@nextcloud/l10n'
import { generateUrl } from '@nextcloud/router'
import { isPublicShare } from '@nextcloud/sharing/public'
import { convertFile, convertFiles } from './convertUtils.ts'
type ConversionsProvider = {
@ -30,7 +31,11 @@ export function registerConvertActions() {
id: `convert-${from}-${to}`,
displayName: () => t('files', 'Save as {displayName}', { displayName }),
iconSvgInline: () => generateIconSvg(to),
enabled: ({ nodes }) => {
enabled: ({ nodes, folder }) => {
if (isPublicShare() && !(folder.permissions & Permission.CREATE)) {
// cannot create the converted file in a public share if we don't have create permissions
return false
}
// Check that all nodes have the same mime type
return nodes.every((node) => from === node.mime)
},

4
dist/files-init.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long