Repository navigation
fix(mobile): enforce image size gate via file measurement before base64 read (#229) - #715
Merged
Merged
Conversation
…64 read (#229) - Measure image file size with fileReader.readSize before reading into base64 - Reject oversized images prior to materializing base64 payload into memory - Allow image resolution when generic file payloads are present in mixed shares - Add unit tests verifying size limit rejection without resolved payloads and with spoofed contentSize - Closes #229
|
The latest updates on your projects. Learn more about Vercel for GitHub. 1 Skipped Deployment
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #229
Summary of Fix
buildIncomingShareDraft(apps/mobile/src/features/sharing/incoming-share-model.ts), image URIs are measured withinput.fileReader.readSize(uri)before callingreadBase64(uri). If the file is oversized (>10 MB) or empty (<=0 bytes), it is rejected with an early warning and temporary owned files are cleaned up, avoiding converting multi-hundred-megabyte files into memory-hogging base64 strings and causing OOM crashes.OpenableColumns.SIZE) that underreports the real size, the disk measurement takes precedence.apps/mobile/src/features/sharing/IncomingShareProvider.tsx, removed the arbitrary condition blockingresolvedPayloadsForFiles()when generic file payloads (file,audio,video) are present alongside images. Mixed shares now correctly resolve image metadata.incoming-share-model.test.tsverifying that oversized images are rejected before base64 conversion both when no resolved payloads exist and when resolvedcontentSizeis inaccurate.Need help on this PR? Tag
@codesmith-botwith what you need. Autofix is disabled.