diff --git a/CHANGELOG.md b/CHANGELOG.md index 66a4b977c..fd6d1335c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file. ## [v1.8.4] - 2023-03-17 +### Fixed + +- permission confusion when removable volume changes + ### Added - TV: improved support for Licenses diff --git a/android/app/src/main/kotlin/deckers/thibault/aves/utils/StorageUtils.kt b/android/app/src/main/kotlin/deckers/thibault/aves/utils/StorageUtils.kt index c73694c99..a02a1a184 100644 --- a/android/app/src/main/kotlin/deckers/thibault/aves/utils/StorageUtils.kt +++ b/android/app/src/main/kotlin/deckers/thibault/aves/utils/StorageUtils.kt @@ -348,7 +348,17 @@ object StorageUtils { // fallback when UUID does not appear in the SD card volume path val primaryVolumePath = getPrimaryVolumePath(context) - getVolumePaths(context).firstOrNull { it != primaryVolumePath }?.let { return it } + getVolumePaths(context).firstOrNull { volumePath -> + if (volumePath == primaryVolumePath) { + false + } else { + // exclude volumes that use regular naming scheme with UUID in them + // to prevent returning path with the UUID of a new volume + // when the argument is the UUID of an obsolete volume + val volumeUuid = volumePath.split(File.separator).lastOrNull { it.isNotEmpty() } + !(volumeUuid == null || volumeUuid.matches(UUID_PATTERN)) + } + }?.let { return it } Log.e(LOG_TAG, "failed to find volume path for UUID=$uuid") return null