22 * SPDX-FileCopyrightText: 2025 Nextcloud GmbH and Nextcloud contributors
33 * SPDX-License-Identifier: AGPL-3.0-or-later
44 */
5+
56import type { Node , View } from '@nextcloud/files'
67
7- import { FileAction , registerFileAction } from '@nextcloud/files'
8+ import { FileAction , Permission , registerFileAction } from '@nextcloud/files'
89import { generateUrl } from '@nextcloud/router'
910import { getCapabilities } from '@nextcloud/capabilities'
1011import { t } from '@nextcloud/l10n'
1112
1213import AutoRenewSvg from '@mdi/svg/svg/autorenew.svg?raw'
1314
1415import { convertFile , convertFiles } from './convertUtils'
16+ import { isPublicShare } from '@nextcloud/sharing/public'
17+ import { useFilesStore } from '../store/files'
1518
1619type ConversionsProvider = {
1720 from : string ,
@@ -28,7 +31,16 @@ export const registerConvertActions = () => {
2831 id : `convert-${ from } -${ to } ` ,
2932 displayName : ( ) => t ( 'files' , 'Save as {displayName}' , { displayName } ) ,
3033 iconSvgInline : ( ) => generateIconSvg ( to ) ,
31- enabled : ( nodes : Node [ ] ) => {
34+ enabled : ( nodes : Node [ ] , view : View ) => {
35+ if ( isPublicShare ( ) ) {
36+ // public shares without create permission cant convert files (no way to save the results)
37+ const store = useFilesStore ( )
38+ const root = store . getRoot ( view . id )
39+ if ( root && ! ( root . permissions & Permission . CREATE ) ) {
40+ return false
41+ }
42+ }
43+
3244 // Check that all nodes have the same mime type
3345 return nodes . every ( node => from === node . mime )
3446 } ,
0 commit comments