-
Notifications
You must be signed in to change notification settings - Fork 1.5k
PM-26201 [Defect] [Safari] Cannot unzip vault export #16909
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Great job! No new security vulnerabilities introduced in this pull request |
Codecov Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
// 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); |
There was a problem hiding this comment.
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
// 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; |
There was a problem hiding this comment.
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
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
|
🎟️ 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 withurl.path
(file:///Users/username/Documents/file.txt
vs/Users/username/Documents/file.txt
)⏰ Reminders before review
🦮 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