diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2023-09-18 14:06:49 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2023-09-18 15:38:02 +0200 |
commit | fb30aa0902478b301fdfbb21af1df58effca459b (patch) | |
tree | cad8f355f16119e528ed236b009f351e49765467 /apps | |
parent | 2845319187c6ae118338575798a3413b4613ecb6 (diff) | |
download | nextcloud-server-fb30aa0902478b301fdfbb21af1df58effca459b.tar.gz nextcloud-server-fb30aa0902478b301fdfbb21af1df58effca459b.zip |
fix(files): allow downloading folders within user root folders only
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/src/actions/downloadAction.ts | 14 | ||||
-rw-r--r-- | apps/systemtags/src/init.ts | 2 |
2 files changed, 14 insertions, 2 deletions
diff --git a/apps/files/src/actions/downloadAction.ts b/apps/files/src/actions/downloadAction.ts index 030e0e818ec..9a3ae828cb6 100644 --- a/apps/files/src/actions/downloadAction.ts +++ b/apps/files/src/actions/downloadAction.ts @@ -47,7 +47,19 @@ export const action = new FileAction({ iconSvgInline: () => ArrowDownSvg, enabled(nodes: Node[]) { - return nodes.length > 0 && nodes + if (nodes.length === 0) { + return false + } + + // We can download direct dav files. But if we have + // some folders, we need to use the /apps/files/ajax/download.php + // endpoint, which only supports user root folder. + if (nodes.some(node => node.type === FileType.Folder) + && !nodes.every(node => node.root?.startsWith('/files'))) { + return false + } + + return nodes .map(node => node.permissions) .every(permission => (permission & Permission.READ) !== 0) }, diff --git a/apps/systemtags/src/init.ts b/apps/systemtags/src/init.ts index ff2e2332633..3dbb606dc87 100644 --- a/apps/systemtags/src/init.ts +++ b/apps/systemtags/src/init.ts @@ -30,7 +30,7 @@ import { getContents } from './services/systemtags.js' const Navigation = getNavigation() Navigation.register(new View({ - id: 'systemtags', + id: 'tags', name: t('systemtags', 'Tags'), caption: t('systemtags', 'List of tags and their associated files and folders.'), |