mirror of
https://github.com/nextcloud/server.git
synced 2026-05-25 02:34:12 -04:00
Merge pull request #49180 from nextcloud/backport/49143/stable30
[stable30] fix(files): view-in-folder enabled conditions
This commit is contained in:
commit
0ac2b2b678
4 changed files with 20 additions and 3 deletions
|
|
@ -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', () => {
|
||||
|
|
|
|||
|
|
@ -30,6 +30,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
|
||||
}
|
||||
|
|
|
|||
4
dist/files-init.js
vendored
4
dist/files-init.js
vendored
File diff suppressed because one or more lines are too long
2
dist/files-init.js.map
vendored
2
dist/files-init.js.map
vendored
File diff suppressed because one or more lines are too long
Loading…
Reference in a new issue