aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristopher Ng <chrng8@gmail.com>2024-09-24 16:01:05 -0700
committerChristopher Ng <chrng8@gmail.com>2024-09-25 14:29:14 -0700
commit4b26578de7fbf006054c519c0fb207af3e1544fb (patch)
tree548dbc7faf21dc73cda54275b5bdbc43489ee0f3
parent3225dc565f62751a1e4644ee57bc2bf52d2d03e6 (diff)
downloadnextcloud-server-4b26578de7fbf006054c519c0fb207af3e1544fb.tar.gz
nextcloud-server-4b26578de7fbf006054c519c0fb207af3e1544fb.zip
fix(files): Fix having to resolve conflicts twice when dropping files
Signed-off-by: Christopher Ng <chrng8@gmail.com>
-rw-r--r--apps/files/src/actions/moveOrCopyAction.ts24
-rw-r--r--apps/files/src/services/DropService.ts3
2 files changed, 14 insertions, 13 deletions
diff --git a/apps/files/src/actions/moveOrCopyAction.ts b/apps/files/src/actions/moveOrCopyAction.ts
index 74193fa0f41..6b6bc5a255e 100644
--- a/apps/files/src/actions/moveOrCopyAction.ts
+++ b/apps/files/src/actions/moveOrCopyAction.ts
@@ -142,19 +142,21 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth
}
} else {
// show conflict file popup if we do not allow overwriting
- const otherNodes = await getContents(destination.path)
- if (hasConflict([node], otherNodes.contents)) {
- try {
- // Let the user choose what to do with the conflicting files
- const { selected, renamed } = await openConflictPicker(destination.path, [node], otherNodes.contents)
- // two empty arrays: either only old files or conflict skipped -> no action required
- if (!selected.length && !renamed.length) {
+ if (!overwrite) {
+ const otherNodes = await getContents(destination.path)
+ if (hasConflict([node], otherNodes.contents)) {
+ try {
+ // Let the user choose what to do with the conflicting files
+ const { selected, renamed } = await openConflictPicker(destination.path, [node], otherNodes.contents)
+ // two empty arrays: either only old files or conflict skipped -> no action required
+ if (!selected.length && !renamed.length) {
+ return
+ }
+ } catch (error) {
+ // User cancelled
+ showError(t('files', 'Move cancelled'))
return
}
- } catch (error) {
- // User cancelled
- showError(t('files', 'Move cancelled'))
- return
}
}
// getting here means either no conflict, file was renamed to keep both files
diff --git a/apps/files/src/services/DropService.ts b/apps/files/src/services/DropService.ts
index d3711741753..20c37f097e7 100644
--- a/apps/files/src/services/DropService.ts
+++ b/apps/files/src/services/DropService.ts
@@ -196,8 +196,7 @@ export const onDropInternalFiles = async (nodes: Node[], destination: Folder, co
for (const node of nodes) {
Vue.set(node, 'status', NodeStatus.LOADING)
- // TODO: resolve potential conflicts prior and force overwrite
- queue.push(handleCopyMoveNodeTo(node, destination, isCopy ? MoveCopyAction.COPY : MoveCopyAction.MOVE))
+ queue.push(handleCopyMoveNodeTo(node, destination, isCopy ? MoveCopyAction.COPY : MoveCopyAction.MOVE, true))
}
// Wait for all promises to settle