From 2a634dc650eb712015d6dde4cfc1868540ea7395 Mon Sep 17 00:00:00 2001 From: JiHyung Lee Date: Thu, 20 Oct 2022 14:53:30 +0900 Subject: [PATCH] (android) Use decoded path when querying file list in directory via assetManager The AssetManager.list function does not automatically decode the passed paths that are encoded. So if the folder name has special characters (such as @), it can't listing subfolders and files. --- src/android/AssetFilesystem.java | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/android/AssetFilesystem.java b/src/android/AssetFilesystem.java index 6d766a4a..f3e63239 100644 --- a/src/android/AssetFilesystem.java +++ b/src/android/AssetFilesystem.java @@ -32,6 +32,7 @@ Licensed to the Apache Software Foundation (ASF) under one import java.io.FileNotFoundException; import java.io.IOException; import java.io.ObjectInputStream; +import java.net.URLDecoder; import java.util.HashMap; import java.util.Map; @@ -91,7 +92,7 @@ private String[] listAssets(String assetPath) throws IOException { if (listCacheFromFile) { ret = new String[0]; } else { - ret = assetManager.list(assetPath); + ret = assetManager.list(URLDecoder.decode(assetPath, "utf-8")); listCache.put(assetPath, ret); } }