Skip to content

Commit 6befdd6

Browse files
authored
Merge pull request #48331 from nextcloud/fix/duplicated-conflict-resolution
fix(files): Fix having to resolve conflicts twice when dropping files
2 parents 62c033e + 8a01b2b commit 6befdd6

6 files changed

Lines changed: 20 additions & 19 deletions

File tree

apps/files/src/actions/moveOrCopyAction.ts

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -123,19 +123,21 @@ export const handleCopyMoveNodeTo = async (node: Node, destination: Folder, meth
123123
}
124124
} else {
125125
// show conflict file popup if we do not allow overwriting
126-
const otherNodes = await getContents(destination.path)
127-
if (hasConflict([node], otherNodes.contents)) {
128-
try {
129-
// Let the user choose what to do with the conflicting files
130-
const { selected, renamed } = await openConflictPicker(destination.path, [node], otherNodes.contents)
131-
// two empty arrays: either only old files or conflict skipped -> no action required
132-
if (!selected.length && !renamed.length) {
126+
if (!overwrite) {
127+
const otherNodes = await getContents(destination.path)
128+
if (hasConflict([node], otherNodes.contents)) {
129+
try {
130+
// Let the user choose what to do with the conflicting files
131+
const { selected, renamed } = await openConflictPicker(destination.path, [node], otherNodes.contents)
132+
// two empty arrays: either only old files or conflict skipped -> no action required
133+
if (!selected.length && !renamed.length) {
134+
return
135+
}
136+
} catch (error) {
137+
// User cancelled
138+
showError(t('files', 'Move cancelled'))
133139
return
134140
}
135-
} catch (error) {
136-
// User cancelled
137-
showError(t('files', 'Move cancelled'))
138-
return
139141
}
140142
}
141143
// getting here means either no conflict, file was renamed to keep both files

apps/files/src/services/DropService.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -178,8 +178,7 @@ export const onDropInternalFiles = async (nodes: Node[], destination: Folder, co
178178

179179
for (const node of nodes) {
180180
Vue.set(node, 'status', NodeStatus.LOADING)
181-
// TODO: resolve potential conflicts prior and force overwrite
182-
queue.push(handleCopyMoveNodeTo(node, destination, isCopy ? MoveCopyAction.COPY : MoveCopyAction.MOVE))
181+
queue.push(handleCopyMoveNodeTo(node, destination, isCopy ? MoveCopyAction.COPY : MoveCopyAction.MOVE, true))
183182
}
184183

185184
// Wait for all promises to settle

dist/files-init.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-init.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/files-main.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)