fix(files): allow downloading folders within user root folders only

Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
This commit is contained in:
John Molakvoæ (skjnldsv) 2023-09-18 14:06:49 +02:00
parent 2845319187
commit fb30aa0902
No known key found for this signature in database
GPG key ID: 60C25B8C072916CF
12 changed files with 28 additions and 41 deletions

View file

@ -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)
},

View file

@ -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.'),

4
dist/core-common.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

4
dist/files-main.js vendored

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

3
dist/systemtags-init.js vendored Normal file

File diff suppressed because one or more lines are too long

View file

@ -1,10 +1,9 @@
/*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */
/**
* @copyright Copyright (c) 2016 Roeland Jago Douma <roeland@famdouma.nl>
* @copyright 2023 Christopher Ng <chrng8@gmail.com>
*
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author Roeland Jago Douma <roeland@famdouma.nl>
* @author Christopher Ng <chrng8@gmail.com>
*
* @license AGPL-3.0-or-later
*
@ -15,7 +14,7 @@
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
@ -44,27 +43,3 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/
/**
* Copyright (c) 2016 Vincent Petry <pvince81@owncloud.com>
*
* @author Joas Schilling <coding@schilljs.com>
* @author John Molakvoæ <skjnldsv@protonmail.com>
* @author Vincent Petry <vincent@nextcloud.com>
*
* @license AGPL-3.0-or-later
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*
*/

1
dist/systemtags-init.js.map vendored Normal file

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long