From 3cd0650bf22d3679c6c84daa695152999a54dd9c Mon Sep 17 00:00:00 2001 From: Dexer <73297572+DexerBR@users.noreply.github.com> Date: Wed, 1 May 2024 14:14:32 -0300 Subject: [PATCH 1/2] parse original uri if path is None --- plyer/platforms/android/filechooser.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/plyer/platforms/android/filechooser.py b/plyer/platforms/android/filechooser.py index b8c943cf..b3d363bd 100644 --- a/plyer/platforms/android/filechooser.py +++ b/plyer/platforms/android/filechooser.py @@ -414,6 +414,7 @@ def _resolve_uri(self, uri): uri_authority = uri.getAuthority() uri_scheme = uri.getScheme().lower() + _uri = uri path = None file_name = None selection = None @@ -449,6 +450,16 @@ def _resolve_uri(self, uri): uri=uri, projection=['_data'], selection=selection, selection_args=[file_name], sort_order=None ) + finally: + # if path is still None, a new attempt will be made using the original uri + if not path: + path = self._parse_content( + uri=_uri, + projection=["_display_name"], + selection=None, + selection_args=None, + sort_order=None, + ) # nothing to parse, file:// will return a proper path elif uri_scheme == 'file': From af11d066946003a2cd5a10c7a22161ca4a25f826 Mon Sep 17 00:00:00 2001 From: Dexer <73297572+DexerBR@users.noreply.github.com> Date: Sun, 5 May 2024 10:31:12 -0300 Subject: [PATCH 2/2] flake8 fix --- plyer/platforms/android/filechooser.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/plyer/platforms/android/filechooser.py b/plyer/platforms/android/filechooser.py index b3d363bd..77cd9115 100644 --- a/plyer/platforms/android/filechooser.py +++ b/plyer/platforms/android/filechooser.py @@ -451,7 +451,8 @@ def _resolve_uri(self, uri): selection_args=[file_name], sort_order=None ) finally: - # if path is still None, a new attempt will be made using the original uri + # if path is still None, a new attempt will be made + # using the original uri if not path: path = self._parse_content( uri=_uri,