#557 fixed permission confusion when removable volume changes

This commit is contained in:
Thibault Deckers 2023-03-18 21:57:43 +01:00
parent 18e120a6d3
commit b15f5832d9
2 changed files with 15 additions and 1 deletions

View file

@ -6,6 +6,10 @@ All notable changes to this project will be documented in this file.
## <a id="v1.8.4"></a>[v1.8.4] - 2023-03-17
### Fixed
- permission confusion when removable volume changes
### Added
- TV: improved support for Licenses

View file

@ -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