From f23522e9b82d01f3649e41a81ab3847aaf7e9074 Mon Sep 17 00:00:00 2001 From: VishnuSanal Date: Wed, 14 Jun 2023 22:16:32 +0530 Subject: [PATCH 1/2] return the actual path for local files Signed-off-by: VishnuSanal --- .../java/com/amaze/filemanager/filesystem/HybridFile.java | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/HybridFile.java b/app/src/main/java/com/amaze/filemanager/filesystem/HybridFile.java index 8f55be3882..8e69b2d97d 100644 --- a/app/src/main/java/com/amaze/filemanager/filesystem/HybridFile.java +++ b/app/src/main/java/com/amaze/filemanager/filesystem/HybridFile.java @@ -416,11 +416,15 @@ public Long execute(@NonNull SFTPClient client) throws IOException { } /** - * Path accessor. Avoid direct access to path since path may have been URL encoded. + * Path accessor. Avoid direct access to path (for non-local files) since path may have been URL + * encoded. * - * @return URL decoded path + * @return URL decoded path (for non-local files); the actual path for local files */ public String getPath() { + + if (isLocal() || isRoot() || isDocumentFile() || isAndroidDataDir()) return path; + try { return URLDecoder.decode(path.replace("+", "%2b"), "UTF-8"); } catch (UnsupportedEncodingException | IllegalArgumentException e) { From f11f6a9d1f21a2b5451a2532ecef4db1e1886c90 Mon Sep 17 00:00:00 2001 From: VishnuSanal Date: Wed, 14 Jun 2023 22:24:01 +0530 Subject: [PATCH 2/2] remove the workaround done to replace plus symbol (via #3661) Signed-off-by: VishnuSanal --- .../main/java/com/amaze/filemanager/filesystem/HybridFile.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/java/com/amaze/filemanager/filesystem/HybridFile.java b/app/src/main/java/com/amaze/filemanager/filesystem/HybridFile.java index 8e69b2d97d..13d9c40bf8 100644 --- a/app/src/main/java/com/amaze/filemanager/filesystem/HybridFile.java +++ b/app/src/main/java/com/amaze/filemanager/filesystem/HybridFile.java @@ -426,7 +426,7 @@ public String getPath() { if (isLocal() || isRoot() || isDocumentFile() || isAndroidDataDir()) return path; try { - return URLDecoder.decode(path.replace("+", "%2b"), "UTF-8"); + return URLDecoder.decode(path, "UTF-8"); } catch (UnsupportedEncodingException | IllegalArgumentException e) { LOG.warn("failed to decode path {}", path, e); return path;