Skip to content

Commit b25e7b8

Browse files
authored
Merge pull request #59865 from nextcloud/backport/59850/stable33
[stable33] fix(files): do not show convert-file action in view-only shares
2 parents b3663bb + 38ad7a2 commit b25e7b8

3 files changed

Lines changed: 10 additions & 5 deletions

File tree

apps/files/src/actions/convertAction.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,10 @@ import type { IFileAction } from '@nextcloud/files'
77

88
import AutoRenewSvg from '@mdi/svg/svg/autorenew.svg?raw'
99
import { getCapabilities } from '@nextcloud/capabilities'
10-
import { registerFileAction } from '@nextcloud/files'
10+
import { Permission, registerFileAction } from '@nextcloud/files'
1111
import { t } from '@nextcloud/l10n'
1212
import { generateUrl } from '@nextcloud/router'
13+
import { isPublicShare } from '@nextcloud/sharing/public'
1314
import { convertFile, convertFiles } from './convertUtils.ts'
1415

1516
type ConversionsProvider = {
@@ -30,7 +31,11 @@ export function registerConvertActions() {
3031
id: `convert-${from}-${to}`,
3132
displayName: () => t('files', 'Save as {displayName}', { displayName }),
3233
iconSvgInline: () => generateIconSvg(to),
33-
enabled: ({ nodes }) => {
34+
enabled: ({ nodes, folder }) => {
35+
if (isPublicShare() && !(folder.permissions & Permission.CREATE)) {
36+
// cannot create the converted file in a public share if we don't have create permissions
37+
return false
38+
}
3439
// Check that all nodes have the same mime type
3540
return nodes.every((node) => from === node.mime)
3641
},

dist/files-init.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)