Skip to content

fix: avoid batch name collisions when keeping both on paste and upload - #3697

Merged
AlexAndBear merged 4 commits into
mainfrom
fix/paste-keepboth-collision
Oct 18, 2026
Merged

AlexAndBear merged 4 commits into
mainfrom
fix/paste-keepboth-collision

Conversation

@AlexAndBear

@AlexAndBear AlexAndBear commented Oct 12, 2026 •

Copy link
Copy Markdown
Member

Description

Keeping both during paste or upload now resolves replacement names against existing target items, other top-level items in the same batch, and replacement names already assigned. For example, when the target contains a.txt and the batch contains a.txt and a (1).txt, the conflicting item becomes a (2).txt and the other item keeps its original name.

Uploads share the reserved names between files and folders. A replacement folder name is assigned once for all its children, preserving their shared destination and updating XHR and TUS endpoints consistently. Nested file names do not reserve names in the target folder.

Related Issue

How Has This Been Tested?

  • test environment: local Vitest with happy-dom; 156 tests pass across the upload conflict helper, ResourceTransfer and HandleUpload.
  • test case 1: pasting a.txt and a (1).txt into a folder containing a.txt with Keep both produces a (2).txt and a (1).txt.
  • test case 2: uploading the same file names reserves the other batch item in either input order and updates the renamed file metadata and XHR endpoint.
  • test case 3: multiple uploaded files with the same original name receive distinct replacement names.
  • test case 4: conflicting folders avoid other batch folder names and share one replacement name across nested children, with matching XHR and TUS paths.
  • test case 5: file and folder replacement names share the same reservations; nested file names do not block names in the target folder.
  • additional checks: root vue-tsc --noEmit, ESLint, Prettier and the PR diff check pass; merge checks against main and PR fix: offer only keep both and skip for upload conflicts between file and folder #3735 report no conflicts.

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

@JammingBen JammingBen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works nicely. I noticed the same for uploading though, probably makes sense to fix it here as well.

@AlexAndBear AlexAndBear changed the title fix: avoid name collisions within the batch when keeping both on paste fix: avoid batch name collisions when keeping both on paste and upload Oct 14, 2026
@AlexAndBear

Copy link
Copy Markdown
Member Author

@JammingBen Extended the fix to uploads: file and folder replacement names now account for the entire batch and previously assigned names, with regression tests for both.

@tammi-23 tammi-23 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works as expected for paste and upload, including the upload fix requested by @JammingBen. LGTM 👍

# Conflicts:
#	packages/web-app-files/tests/unit/helpers/resource/actions/upload.spec.ts
@AlexAndBear
AlexAndBear merged commit a1b0a62 into main Oct 18, 2026
27 checks passed
@AlexAndBear
AlexAndBear deleted the fix/paste-keepboth-collision branch October 18, 2026 13:16
@openclouders openclouders mentioned this pull request Oct 18, 2026
1 task
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Keep both" on paste picks a name another pasted item already uses; that item isn't copied

3 participants