Skip to content

[PM-20344] Disallow multiple attachments with the same name, handle existing in zip export format#21596

Merged
mcamirault merged 4 commits into
mainfrom
tools/pm-20344/handle-duplicate-attachment-names
Jul 8, 2026
Merged

[PM-20344] Disallow multiple attachments with the same name, handle existing in zip export format#21596
mcamirault merged 4 commits into
mainfrom
tools/pm-20344/handle-duplicate-attachment-names

Conversation

@mcamirault

@mcamirault mcamirault commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-20344

📔 Objective

Currently when a cipher has multiple attachments with the same filename only one of them will be included when exporting in Bitwarden's zip format. This PR handles conflicting attachment filenames by having duplicates use a numeric suffix, and also makes the overall attachment folder easier to parse by using cipher names instead of IDs for the folders that contain the individual attachments (again handling duplicate names by using a numeric suffix).

For example, consider a vault that has two ciphers with the same name ("Test Cipher"), and each cipher has two attachments whose names are the same (one has two called "foo.txt" and the other has two called "bar.txt"). The exported attachments folder structure will look like this:

attachments
└───Test Cipher
│   │   foo.txt
│   │   foo_1.txt
|
└───Test Cipher_1
    │   bar.txt
    │   bar_1.txt

This PR also adjusts the Vault item attachments component to no longer allow duplicate attachment names and show an error toast if a duplicate upload is attempted.

📸 Screenshots

Screen.Recording.2026-06-30.at.13.11.37.mov

@mcamirault mcamirault requested review from a team as code owners June 30, 2026 17:37
@github-actions

github-actions Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

🤖 Bitwarden Claude Code Review

Overall Assessment: REQUEST CHANGES

Reviewed the attachment duplicate-name handling for the Bitwarden zip export and the new client-side guard against uploading duplicate attachment names. The export now folders attachments by cipher name (with (N) prefixes for duplicate cipher and attachment names) instead of cipher IDs, and the attachments component blocks duplicate uploads with an error toast. The new i18n key was correctly added to the browser, desktop, and web en locales, and test coverage was added on both the export service and the component.

Code Review Details
  • ⚠️ : Unsanitized cipher.name used as zip folder name can break export or create unintended nested paths
    • libs/tools/export-vault-core/src/services/individual-vault-export.service.ts:123

@sonarqubecloud

Copy link
Copy Markdown

Comment thread libs/tools/export-vault-core/src/services/individual-vault-export.service.ts Outdated
@codecov

codecov Bot commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 96.55172% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 49.70%. Comparing base (e672eec) to head (e1aefd2).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...onents/attachments/cipher-attachments.component.ts 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #21596      +/-   ##
==========================================
+ Coverage   49.69%   49.70%   +0.01%     
==========================================
  Files        4119     4119              
  Lines      129334   129361      +27     
  Branches    19816    19819       +3     
==========================================
+ Hits        64271    64298      +27     
+ Misses      60298    60297       -1     
- Partials     4765     4766       +1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Comment thread apps/web/src/locales/en/messages.json
nick-livefront
nick-livefront previously approved these changes Jun 30, 2026

@nick-livefront nick-livefront left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Vault changes look good ✅

harr1424
harr1424 previously approved these changes Jul 2, 2026
nick-livefront
nick-livefront previously approved these changes Jul 6, 2026

@nick-livefront nick-livefront left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

@mcamirault FYI, some conflicts to fix!

@mcamirault mcamirault dismissed stale reviews from nick-livefront and harr1424 via e1aefd2 July 8, 2026 17:32
@mcamirault mcamirault added needs-qa Marks a PR as requiring QA approval t:feature Change Type - Feature Development labels Jul 8, 2026
@mcamirault mcamirault removed the needs-qa Marks a PR as requiring QA approval label Jul 8, 2026
@mcamirault mcamirault requested a review from harr1424 July 8, 2026 21:55
@mcamirault mcamirault merged commit f47b694 into main Jul 8, 2026
145 of 152 checks passed
@mcamirault mcamirault deleted the tools/pm-20344/handle-duplicate-attachment-names branch July 8, 2026 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t:feature Change Type - Feature Development

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants