Fix document picker null name crash#34
Merged
marcprux merged 3 commits intoJun 11, 2026
Merged
Conversation
…nent Some content providers (notably Downloads) omit DISPLAY_NAME, which made `getColumnIndexOrThrow` throw and `selectedFilename.wrappedValue!` NPE. Separately, building the destination via `URL.appendingPathComponent` hit a NullPointerException inside skip.foundation.URL._appendingPathComponent on inputs containing encoded whitespace. - Use getColumnIndex (not …OrThrow) and tolerate -1 / null. - Fall back to a UUID-derived filename when DISPLAY_NAME is null. - Fall back to ContentResolver.getType for missing mime. - Build the cache destination with java.io.File(cacheDir, safeName) to avoid Skip's URL helper entirely. - Replace `resolver.openInputStream(uri)!` force-unwrap with a guard.
URL(fileURLWithPath:) feeds the raw path to java.net.URI, which rejects
unencoded spaces / parens. Picked files frequently have such characters
in DISPLAY_NAME ("African American Praise medley (Henrisoul).mp3"), so
the post-copy URL construction crashed with URISyntaxException at
"Illegal character in path at index N".
java.io.File.toURI() percent-encodes the path, so wrapping its result
with URL(platformValue:) gives a valid file URL on every input.
Member
|
This looks good! Can you explain the circumstances around the crash that you were experiencing? |
Contributor
Author
Yeah, forgot to make a screen recording. pretty much my app allows users to upload audio files, while running on android I tried to upload files from the downloads folder and as soon as the file was selected the app would crash. |
Member
|
Fixes #31 |
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.
Thank you for contributing to the Skip project! Please use this space to describe your change and add any labels (bug, enhancement, documentation, etc.) to help categorize your contribution.
Please review the contribution guide at https://skip.dev/docs/contributing/ for advice and guidance on making high-quality PRs.
Skip Pull Request Checklist:
swift test