diff --git a/src/android/app/src/main/java/org/citra/citra_emu/utils/FileUtil.java b/src/android/app/src/main/java/org/citra/citra_emu/utils/FileUtil.java index a19d15b6a4..b99a35bc0d 100644 --- a/src/android/app/src/main/java/org/citra/citra_emu/utils/FileUtil.java +++ b/src/android/app/src/main/java/org/citra/citra_emu/utils/FileUtil.java @@ -425,9 +425,12 @@ public class FileUtil { } public static String getFilenameWithExtensions(Uri uri) { - final String path = uri.getPath(); - final int index = path.lastIndexOf('/'); - return path.substring(index + 1); + String path = uri.getPath(); + final int slashIndex = path.lastIndexOf('/'); + path = path.substring(slashIndex + 1); + // On Android versions below 10, it is possible to select the storage root, which might result in filenames with a colon. + final int colonIndex = path.indexOf(':'); + return path.substring(colonIndex + 1); } public static double getFreeSpace(Context context, Uri uri) {