fix(mobile): caching thumbnails to disk (#21275)

This commit is contained in:
Mert
2025-08-26 11:49:12 -04:00
committed by GitHub
parent 19c53609e1
commit e67265cef2
3 changed files with 51 additions and 26 deletions

View File

@@ -38,9 +38,21 @@ abstract class RemoteCacheManager extends CacheManager {
final file = await store.fileSystem.createFile(path);
final sink = file.openWrite();
try {
await source.pipe(sink);
await source.listen(sink.add, cancelOnError: true).asFuture();
} catch (e) {
try {
await sink.close();
await file.delete();
} catch (e) {
_log.severe('Failed to delete incomplete cache file: $e');
}
return;
}
try {
await sink.flush();
await sink.close();
} catch (e) {
try {
await file.delete();
} catch (e) {