mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-09-19 00:02:15 +02:00
fix: restore SAF metadata fallback and preserve active transfers
Propagate filesystem errors from complete metadata reads so Android retries unreadable SAF descriptors through temporary files while accepting valid audio without tags. Keep established segmented and chunked transfers outside the resolution allowance. Continue charging initial requests, retries, and progress callbacks, including during parallel native reads, while preserving stall cancellation. Add metadata, transfer, and native fallback regression tests. Validated with Go tests, race detector, vet, Android tests, targeted Flutter tests, analyzer, and formatting checks.
This commit is contained in:
@@ -6,6 +6,14 @@ import org.junit.Assert.assertNull
|
||||
import org.junit.Test
|
||||
|
||||
class SafMetadataReadPolicyTest {
|
||||
@Test fun completeMetadataReadErrorUsesTemporaryCopy() {
|
||||
val metadata = mapOf("lyrics" to "words", "comment" to "notes", "track_number" to 3)
|
||||
assertEquals(metadata, readSafMetadataWithFallback(
|
||||
directRead = { throw Exception("failed to read metadata: permission denied") },
|
||||
fallbackRead = { metadata },
|
||||
))
|
||||
}
|
||||
|
||||
@Test fun fallbackFailureIsIsolatedToOneFile() {
|
||||
assertNull(readSafMetadataWithFallback<String>({ null }, { throw IllegalArgumentException("malformed metadata") }))
|
||||
assertEquals("next file", readSafMetadataWithFallback({ "next file" }, { error("copy") }))
|
||||
|
||||
Reference in New Issue
Block a user