aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src
diff options
context:
space:
mode:
authorJohn Molakvoæ <skjnldsv@users.noreply.github.com>2024-11-09 12:01:48 +0100
committerGitHub <noreply@github.com>2024-11-09 12:01:48 +0100
commit858d24aeab19bdd57dbacf9635364c1d3be00c5b (patch)
treef325b3f1ed53c2b8b272f4befc88466ec3eef0cc /apps/files/src
parent4a2091ecb76057f5791034b02a47c0297e1548b5 (diff)
parent6b76c7c7a017567ec0f2577d230ca907da66e154 (diff)
downloadnextcloud-server-858d24aeab19bdd57dbacf9635364c1d3be00c5b.tar.gz
nextcloud-server-858d24aeab19bdd57dbacf9635364c1d3be00c5b.zip
Merge pull request #49143 from nextcloud/fix/view-in-folder-conditions
Diffstat (limited to 'apps/files/src')
-rw-r--r--apps/files/src/actions/viewInFolderAction.spec.ts12
-rw-r--r--apps/files/src/actions/viewInFolderAction.ts5
2 files changed, 17 insertions, 0 deletions
diff --git a/apps/files/src/actions/viewInFolderAction.spec.ts b/apps/files/src/actions/viewInFolderAction.spec.ts
index 8aa8bc81922..bd618c8a89f 100644
--- a/apps/files/src/actions/viewInFolderAction.spec.ts
+++ b/apps/files/src/actions/viewInFolderAction.spec.ts
@@ -109,6 +109,18 @@ describe('View in folder action enabled tests', () => {
expect(action.enabled).toBeDefined()
expect(action.enabled!([folder], view)).toBe(false)
})
+
+ test('Disabled for files outside the user root folder', () => {
+ const file = new Folder({
+ id: 1,
+ source: 'https://cloud.domain.com/remote.php/dav/trashbin/admin/trash/image.jpg.d1731053878',
+ owner: 'admin',
+ permissions: Permission.READ,
+ })
+
+ expect(action.enabled).toBeDefined()
+ expect(action.enabled!([file], view)).toBe(false)
+ })
})
describe('View in folder action execute tests', () => {
diff --git a/apps/files/src/actions/viewInFolderAction.ts b/apps/files/src/actions/viewInFolderAction.ts
index 9a9775d1c65..eb145dc409f 100644
--- a/apps/files/src/actions/viewInFolderAction.ts
+++ b/apps/files/src/actions/viewInFolderAction.ts
@@ -36,6 +36,11 @@ export const action = new FileAction({
return false
}
+ // Can only view files that are in the user root folder
+ if (!node.root?.startsWith('/files')) {
+ return false
+ }
+
if (node.permissions === Permission.NONE) {
return false
}