mirror of
https://github.com/nextcloud/server.git
synced 2026-06-06 23:34:22 -04:00
fix(files): Correct condition for checking copy/move into same directory
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
This commit is contained in:
parent
77970de9f3
commit
f695df8506
1 changed files with 7 additions and 1 deletions
|
|
@ -80,7 +80,13 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth
|
|||
throw new Error(t('files', 'This file/folder is already in that directory'))
|
||||
}
|
||||
|
||||
if (node.path.startsWith(destination.path)) {
|
||||
/**
|
||||
* Example:
|
||||
* node: /foo/bar/file.txt -> path = /foo/bar
|
||||
* destination: /foo
|
||||
* Allow move of /foo does not start with /foo/bar so allow
|
||||
*/
|
||||
if (destination.path.startsWith(node.path)) {
|
||||
throw new Error(t('files', 'You cannot move a file/folder onto itself or into a subfolder of itself'))
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue