fix(storage): decode data URLs with custom content types - #9258
fix(storage): decode data URLs with custom content types#9258OskarEichler wants to merge 1 commit into
Conversation
mikehardy
left a comment
There was a problem hiding this comment.
Hey @OskarEichler 👋
Thanks for the PR — the real-problem analysis looks right to me, and I like the unit coverage. I ran local Jest plus the android/ios/macos e2e suite here. Android and iOS are green on the new case, but macOS failed, so I'm requesting changes until we understand that path.
macOS e2e failure from our run:
storage() -> StorageTask
StorageTask modular
putString()
uploads a data_url with an explicit content type:
AssertionError: expected 8 to equal 5
at packages/storage/e2e/StorageTask.e2e.js:185:51
The test uploads data:text/plain;base64,aGVsbG8= with { contentType: 'text/custom' } and expects metadata.size === 5 (decoded hello). macOS reported 8, which looks like the undecoded base64 payload length rather than the decoded bytes.
We have a lot of trouble on the firebase-js-sdk / HermesVM target when it comes to base64 and Web APIs in general — atob, btoa, Blob, FileReader, data URLs, and friends have all been edge-case magnets for us. I think this may be a similar edge case on macOS rather than a simple one-line fix being wrong on mobile.
Could you dig into why macOS still uploads the undecoded payload when an explicit contentType is set, and whether the fix needs a Hermes-specific path (or a different assertion strategy on macOS)? Happy to pair on it if useful.
Cheers
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #9258 +/- ##
============================================
+ Coverage 68.50% 68.78% +0.29%
Complexity 1915 1915
============================================
Files 522 482 -40
Lines 38116 35606 -2510
Branches 5189 5033 -156
============================================
- Hits 26108 24489 -1619
+ Misses 10222 9317 -905
- Partials 1786 1800 +14
Flags with carried forward coverage won't be shown. Click here to find out more. 🚀 New features to boost your workflow:
|
|
I traced the macOS path. The PR’s |
Compatibility
What changed
Verification