Compare commits

...

2 Commits

Author SHA1 Message Date
thumb2086
ffb1988d5c
Merge 07031cb564 into 0ac949dc1b 2026-02-14 02:00:58 -05:00
thumb2086
07031cb564 fix: prevent metadata corruption for weba and flac files
- Skip metadata writing for flac files to prevent file corruption
- FLAC files have strict header requirements where writing metadata after download can corrupt the sync code and make files unplayable
- Update download_manager_provider.dart to check for both weba and flac extensions
- Update server/routes/playback.dart to check for both weba and flac extensions
- Add explanatory comments documenting why metadata writing is skipped for these formats
- Refactor extension checking to use variable assignment for clarity
2025-11-25 23:31:16 +08:00
2 changed files with 10 additions and 2 deletions

View File

@ -239,7 +239,11 @@ class DownloadManagerNotifier extends Notifier<List<DownloadTask>> {
return; return;
} }
if (container.getFileExtension() == "weba") return; // Skip metadata writing for weba and flac to prevent file corruption
// FLAC files have strict header requirements and writing metadata after
// download can corrupt the sync code and make files unplayable
final extension = container.getFileExtension();
if (extension == "weba" || extension == "flac") return;
final imageBytes = await ServiceUtils.downloadImage( final imageBytes = await ServiceUtils.downloadImage(
(task.track.album.images).asUrlString( (task.track.album.images).asUrlString(

View File

@ -247,7 +247,11 @@ class ServerPlaybackRoutes {
await trackPartialCacheFile.rename(trackCacheFile.path); await trackPartialCacheFile.rename(trackCacheFile.path);
if (track.qualityPreset!.getFileExtension() == "weba") return; // Skip metadata writing for weba and flac to prevent file corruption
// FLAC files have strict header requirements and writing metadata after
// download can corrupt the sync code and make files unplayable
final extension = track.qualityPreset!.getFileExtension();
if (extension == "weba" || extension == "flac") return;
final imageBytes = await ServiceUtils.downloadImage( final imageBytes = await ServiceUtils.downloadImage(
track.query.album.images.asUrlString( track.query.album.images.asUrlString(