mirror of
https://github.com/zarzet/SpotiFLAC-Mobile.git
synced 2026-07-26 14:01:03 +02:00
d819878ec7
The non-SAF filesystem path (Android direct mode and all of iOS) had none of the safeguards the SAF path gained: extension downloads streamed straight into the final filename, every error path stranded the partial file there, and the ISRC duplicate check (exists + size>0 with a head-only FLAC parse) then accepted the truncated file as complete forever. On iOS this was routine, not rare: the background task grace is ~30s, after which the process is suspended mid-stream. - fileDownload/fileDownloadChunked now stream into a .partial sibling and promote to the final name with an atomic rename on success; failures remove the staged file and never touch the final name - fileWrite (full-content) uses the same stage-and-rename protocol - writes are serialized per final output path, so concurrent queue items that resolve to the same filename can no longer interleave bytes into one file The staged suffix keeps partials invisible to extension duplicate checks, which match on the final audio extension.