Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Android Download folder files get the wrong filenames on Android 13 #17462

Closed
hrydgard opened this issue May 15, 2023 · 1 comment · Fixed by #17466
Closed

Android Download folder files get the wrong filenames on Android 13 #17462

hrydgard opened this issue May 15, 2023 · 1 comment · Fixed by #17466
Labels
Platform-specific (Android) Scoped Storage Related to scoped storage on Android
Milestone

Comments

@hrydgard
Copy link
Owner

hrydgard commented May 15, 2023

When clicking Load... the content URI returned doesn't preserve the actual filename of the file being opened, instead what we get is like:

content://com.android.providers.downloads.documents/document/msf%3A10000000006

This is a problem because we rely on the filename a lot in file format detection, so you can't load elfs that way for example, let's say you download cube.elf from https://www.ppsspp.org/legacybuilds/ for example.

Two ways of fixing it:

  • Go query the actual filename and get the extension separately. This complicates our internal storage API quite a bit.
  • Change our file format detection to actually look more at bytes if there's no extension. Probably the easier option though for 1.15.4 I'll limit it to only do this check ELF, ISO, and CSO.
    • Actually, we partially already do this. I'll make it a little bit more complete.
@hrydgard hrydgard added this to the v1.15.4 milestone May 15, 2023
@hrydgard hrydgard added the Scoped Storage Related to scoped storage on Android label May 15, 2023
@hrydgard
Copy link
Owner Author

hrydgard commented May 15, 2023

Alright, turns out I misdiagnosed the problem. This is what we're getting:

05-15 19:54:13.947 30543 30762 I PPSSPP : [COMMON] Android_OpenContentUriFd: content://com.android.providers.downloads.documents/document/msf%3A1000000006%2F1000000006 (READ)
05-15 19:54:13.949 30543 30762 E PpssppActivity: openContentUri exception: java.lang.SecurityException: Permission Denial: reading com.android.providers.downloads.DownloadStorageProvider uri content://com.android.providers.downloads.documents/document/msf%3A1000000006%2F1000000006 from pid=30543, uid=10333 requires that you obtain access using ACTION_OPEN_DOCUMENT or related APIs

But, we did get the path through ACTION_OPEN_DOCUMENT? Anyway, we can detect this and put up an appropriate error message, at least...

No actually, there seems to be some double-concatenation of the filename here: msf%3A1000000006%2F1000000006 ...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Platform-specific (Android) Scoped Storage Related to scoped storage on Android
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant