diff options
author | Simon L. <szaimen@e.mail.de> | 2024-09-25 12:05:13 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-25 12:05:13 +0200 |
commit | 6befdd6dd7cd20fe7f7036e4665bcfbb783d6803 (patch) | |
tree | a7f9d051085c858f3ebae1d7074d2ba8361a1d04 /apps | |
parent | 62c033e4ca25c958d649e0a1842df78a7f985d44 (diff) | |
parent | 8a01b2be07d136742c0f31721f1fbeb0a43de2d0 (diff) | |
download | nextcloud-server-6befdd6dd7cd20fe7f7036e4665bcfbb783d6803.tar.gz nextcloud-server-6befdd6dd7cd20fe7f7036e4665bcfbb783d6803.zip |
Merge pull request #48331 from nextcloud/fix/duplicated-conflict-resolution
fix(files): Fix having to resolve conflicts twice when dropping files
Diffstat (limited to 'apps')
-rw-r--r-- | apps/files/src/actions/moveOrCopyAction.ts | 24 | ||||
-rw-r--r-- | apps/files/src/services/DropService.ts | 3 |
2 files changed, 14 insertions, 13 deletions
diff --git a/apps/files/src/actions/moveOrCopyAction.ts b/apps/files/src/actions/moveOrCopyAction.ts index 13840540a38..78424c748cd 100644 --- a/apps/files/src/actions/moveOrCopyAction.ts +++ b/apps/files/src/actions/moveOrCopyAction.ts @@ -123,19 +123,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 63e7c213f4f..1013baeda6c 100644 --- a/apps/files/src/services/DropService.ts +++ b/apps/files/src/services/DropService.ts @@ -178,8 +178,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 |