Davedeji · GitHub

added 3 commits

June 9, 2026 18:28
…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.

Open

@marcprux

Read the original on github.com ↗