diff options
author | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-01-19 20:19:59 +0100 |
---|---|---|
committer | Ferdinand Thiessen <opensource@fthiessen.de> | 2024-01-20 15:41:53 +0100 |
commit | a289fdd2d757c85888efaaa2bcfe06733976fd88 (patch) | |
tree | 2bec566bc76ac6f0810a21028395928d152ded3f /apps/files/src | |
parent | b29c0cca24188fdd01679045cfdd18c91fad9a15 (diff) | |
download | nextcloud-server-a289fdd2d757c85888efaaa2bcfe06733976fd88.tar.gz nextcloud-server-a289fdd2d757c85888efaaa2bcfe06733976fd88.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/files/src')
-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')) } |