Common: Fix SplitPath for percent-encoded separators in SAF-style URIs#14633
Common: Fix SplitPath for percent-encoded separators in SAF-style URIs#14633jbripley wants to merge 1 commit into
Conversation
|
I lack experience in Android development but I have some questions:
IMHO, I don't think that's a good idea for the generic That said, I'm not well-versed in Android development so I'd wait for other reviewers comments with a better Android background on that matter. In case this function should support URI path on top of regular filepath, it should probably be renamed to something less confusing. |
|
Does this actually let you usefully use m3u files? As I understand it, the only way we currently have in Dolphin to open an m3u file is by opening a single file, and when you open a single file, Android won't give you permission to access other files in the same folder. Unless you've previously added that folder to your game list so Dolphin has access to all files in it, but then why not just use the game list instead of manually opening an m3u file? I should also mention that content providers are not guaranteed to encode a path in the URI like this, and indeed, many content providers don't. The one content provider that literally everyone uses does, but technically that's undocumented behavior that to me feels shaky to rely on. I also share sepalani's concern about this breaking non-SAF paths that happen to contain %, which in theory can exist even on Android. |
Summary
Fix
SplitPathso it correctly handles paths/URIs where path separators are percent-encoded (for example%2F), which affects Android Storage Access Framework (SAF)-stylecontent://.../document/...paths used when opening.m3uplaylists.Without this,
SplitPathcan derive an incorrect parent path from SAF document URIs, causing downstream path resolution failures (including.m3uentry lookups).What changed
Common::SplitPathseparator scanning to treat percent-encoded bytes as decoded characters during separator detection.%xxbytes (std::optional<char>-based).:separator behavior.StringUtilTest.Files
Source/Core/Common/StringUtil.cppSource/UnitTests/Common/StringUtilTest.cppVerification
Ran full unit tests:
ctest --test-dir build/Source/UnitTests --output-on-failureResult:
100% tests passed, 0 tests failed.