diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-01-19 20:19:59 +0100 |
---|---|---|
committer | Eduardo Morales <emoral435@gmail.com> | 2024-01-20 12:42:45 -0600 |
commit | 84e2165aef54cfb2cd93a1428c6b74a8a39b9016 (patch) | |
tree | 1fda7fb44a11ef0b3f56368eae5b48dafc5e936a /apps | |
parent | 20331e4349dc687796c612bf99913c765cbf3054 (diff) | |
download | nextcloud-server-84e2165aef54cfb2cd93a1428c6b74a8a39b9016.tar.gz nextcloud-server-84e2165aef54cfb2cd93a1428c6b74a8a39b9016.zip |
fix(files): Allow to copy or move file to folder with similar name
Signed-off-by: Ferdinand Thiessen <opensource@fthiessen.de>
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/src/actions/moveOrCopyAction.ts | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/apps/files/src/actions/moveOrCopyAction.ts b/apps/files/src/actions/moveOrCopyAction.ts index 42ae82bb261..a4e70caf37d 100644 --- a/apps/files/src/actions/moveOrCopyAction.ts +++ b/apps/files/src/actions/moveOrCopyAction.ts @@ -89,8 +89,10 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth * Do not allow as it would copy foo within itself * - node: /foo/bar.txt, destination: /foo * Allow copy a file to the same directory + * - node: "/foo/bar", destination: "/foo/bar 1" + * Allow to move or copy but we need to check with trailing / otherwise it would report false positive */ - if (destination.path.startsWith(node.path)) { + 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')) } |