fix: unable to open input stream from content resolver for Uri#20918
Open
criticalAY wants to merge 9 commits intoankidroid:mainfrom
Open
fix: unable to open input stream from content resolver for Uri#20918criticalAY wants to merge 9 commits intoankidroid:mainfrom
criticalAY wants to merge 9 commits intoankidroid:mainfrom
Conversation
Removes the openMultimediaImageFragment helper. Bottom-sheet dispatch and the paste path now build their launch intents through the same handler.
handleMultimediaActions, handleMultimediaResult, performAddMedia and the multimediaActionJob state now live on a NoteEditorMultimediaController. The fragment keeps the ActivityResultLauncher registration (framework requirement) and forwards its callback.
The paste-image path now delegates to launchImagePaste, mirroring the bottom-sheet dispatch. pastedImageCache and its savedInstanceState plumbing move with it; the fragment forwards save/restore through onSaveInstanceState / onRestoreInstanceState on the controller.
onPaste moves; shouldPasteAsPng stays on the fragment because the paste listener is synchronous.
…ract test: cover NoteEditorMultimediaController save/restore plumbing
…lver test: cover file/content URI branching in MultimediaImageUri helpers
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.
Purpose / Description
Fix SecurityException: unsafe-content-uri-resolution when sharing an image into the note editor: file:// URIs pointing at our own /data/.../cache were being routed back through Android's content resolver, which rejects them.
Fixes
Approach
Two new helpers in MultimediaImageUri.kt (resolveFileFromUri, openImageInputStream) read those URIs directly via java.io and delegate everything else to the caller's content-resolver path
How Has This Been Tested?
7 unit tests and Pixel 10, shared image from Photos and it was added
Learning (optional, can help others)
NA
Checklist
Please, go through these checks before submitting the PR.