Skip to content

Commit

Permalink
Merge pull request #3854 from TeamAmaze/fix-html-formatted-paths
Browse files Browse the repository at this point in the history
Return the actual path for local files
  • Loading branch information
VishalNehra authored Oct 29, 2023
2 parents 6783e4d + f11f6a9 commit 67822e9
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -411,13 +411,17 @@ public long length(Context context) {
}

/**
* 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");
return URLDecoder.decode(path, "UTF-8");
} catch (UnsupportedEncodingException | IllegalArgumentException e) {
LOG.warn("failed to decode path {}", path, e);
return path;
Expand Down

0 comments on commit 67822e9

Please sign in to comment.