Compare commits

...
Sign in to create a new pull request.

1 commit

Author SHA1 Message Date
Tommy Chow
c07c67b662 fix orphaned cache cleanup 2025-06-14 17:09:28 -04:00

View file

@ -23,14 +23,15 @@ class CustomCacheManager {
return;
}
final allFiles = cacheDir.listSync(recursive: true).toList();
final allFiles =
cacheDir.listSync(recursive: true).whereType<File>().toList();
await _repo.open();
final cachedObjects = await _repo.getAllObjects();
final dbFiles = cachedObjects.map((e) => e.relativePath).toSet();
final orphanedFiles = allFiles.where((file) {
final relativePath = file.path.split('$key/').last;
final relativePath = file.path.replaceFirst('${cacheDir.path}/', '');
return !dbFiles.contains(relativePath);
}).toList();