Skip to content

Conversation

harr1424
Copy link
Contributor

@harr1424 harr1424 commented Oct 16, 2025

🎟️ Tracking

https://bitwarden.atlassian.net/browse/PM-26201?atlOrigin=eyJpIjoiZDM5NGNkNGIzNTEwNGYyMDhmYjc1NmJjNWI0OTI4Y2UiLCJwIjoiaiJ9

📔 Objective

This PR fixes a bug whereby exporting a vault as a .zip archive resulted in an empty .zip archive:

• data received as blob could not be directly converted to a base64 encoded string, and needed to be converted to a byte array first
• usage of Swift's url.absoluteString was replaced with url.path (file:///Users/username/Documents/file.txt vs /Users/username/Documents/file.txt)

⏰ Reminders before review

  • Contributor guidelines followed
  • All formatters and local linters executed and passed
  • Written new unit and / or integration tests where applicable
  • Protected functional changes with optionality (feature flags)
  • Used internationalization (i18n) for all UI strings
  • CI builds passed
  • Communicated to DevOps any deployment requirements
  • Updated any necessary documentation (Confluence, contributing docs) or informed the documentation team

🦮 Reviewer guidelines

  • 👍 (:+1:) or similar for great changes
  • 📝 (:memo:) or ℹ️ (:information_source:) for notes or general info
  • ❓ (:question:) for questions
  • 🤔 (:thinking:) or 💭 (:thought_balloon:) for more open inquiry that's not quite a confirmed issue and could potentially benefit from discussion
  • 🎨 (:art:) for suggestions / improvements
  • ❌ (:x:) or ⚠️ (:warning:) for more significant problems or concerns needing attention
  • 🌱 (:seedling:) or ♻️ (:recycle:) for future improvements or indications of technical debt
  • ⛏ (:pick:) for minor or nitpick changes

@harr1424 harr1424 requested a review from a team as a code owner October 16, 2025 21:34
@harr1424 harr1424 requested a review from coroiu October 16, 2025 21:34
Copy link
Contributor

github-actions bot commented Oct 16, 2025

Logo
Checkmarx One – Scan Summary & Detailsa5873cb8-b1b1-46f8-a6ce-f274da7c982e

Great job! No new security vulnerabilities introduced in this pull request

Copy link

codecov bot commented Oct 16, 2025

Codecov Report

❌ Patch coverage is 0% with 9 lines in your changes missing coverage. Please review.
✅ Project coverage is 39.18%. Comparing base (13f3792) to head (6164c27).
⚠️ Report is 37 commits behind head on main.
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
...rm/popup/services/browser-file-download.service.ts 0.00% 9 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main   #16909      +/-   ##
==========================================
+ Coverage   38.94%   39.18%   +0.23%     
==========================================
  Files        3437     3460      +23     
  Lines       97511    98090     +579     
  Branches    14667    14736      +69     
==========================================
+ Hits        37978    38437     +459     
- Misses      57874    57983     +109     
- Partials     1659     1670      +11     

☔ View full report in Codecov by Sentry.
📢 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 on lines 18 to 21
// Handle Safari download asynchronously to allow Blob conversion
// This function can't be async because the interface is not async
// eslint-disable-next-line @typescript-eslint/no-floating-promises
SafariApp.sendMessageToApp(
"downloadFile",
JSON.stringify({
blobData: data,
blobOptions: request.blobOptions,
fileName: request.fileName,
}),
true,
);
this.downloadSafari(request, builder);
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: use void to be explicit about not waiting on a promise

Suggested change
// Handle Safari download asynchronously to allow Blob conversion
// This function can't be async because the interface is not async
// eslint-disable-next-line @typescript-eslint/no-floating-promises
SafariApp.sendMessageToApp(
"downloadFile",
JSON.stringify({
blobData: data,
blobOptions: request.blobOptions,
fileName: request.fileName,
}),
true,
);
this.downloadSafari(request, builder);
// Handle Safari download asynchronously to allow Blob conversion
// This function can't be async because the interface is not async
SafariApp.sendMessageToApp(
"downloadFile",
JSON.stringify({
blobData: data,
blobOptions: request.blobOptions,
fileName: request.fileName,
}),
true,
);
void this.downloadSafari(request, builder);

request: FileDownloadRequest,
builder: FileDownloadBuilder,
): Promise<void> {
let data: BlobPart = null;
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: it seems you are explicitly converting the data to string

Suggested change
let data: BlobPart = null;
let data: string = null;

• explicitly discard promise returned by `downloadSafari()`
• confine `data` type to `string` since code all code paths assign a `string` value
Copy link

@harr1424 harr1424 requested a review from coroiu October 17, 2025 14:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants