aboutsummaryrefslogtreecommitdiffstats
path: root/apps/files/src
diff options
context:
space:
mode:
authorFerdinand Thiessen <opensource@fthiessen.de>2024-01-19 20:19:59 +0100
committerFerdinand Thiessen <opensource@fthiessen.de>2024-01-20 15:41:53 +0100
commita289fdd2d757c85888efaaa2bcfe06733976fd88 (patch)
tree2bec566bc76ac6f0810a21028395928d152ded3f /apps/files/src
parentb29c0cca24188fdd01679045cfdd18c91fad9a15 (diff)
downloadnextcloud-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.ts4
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'))
}