Baseflow / Baseflow/flutter_cache_manager
CacheManager saves files with the same path
- Dominant language
- Dart
- Stars
- 809
- Forks
- 510
- Avg merge
- 6m
- Merged PRs (30d)
- 1
Description
## 🐛 Bug Report
Scheduled file cleanup on CachedNetworkImage throws `FileSystemException: Cannot delete file`. [Issue](https://github.com/Baseflow/flutter_cached_network_image/issues/335)
After research, it turned out that different images are recorded along the same path. This happens because relativePath encoding uses Uuid().v1() , which uses DateTime.now() , which causes our error when loading a lot of files at the same time.
To solve this problem, changing the path encoding in _flutter_cache_manager-3.3.0/lib/src/cache_manager.dart_ `putFile` and `putFileStream` should help. for example, change **v1** to **v4**, which uses a more random encoding
```
> cacheObject ??= CacheObject(
> url,
> key: key,
> relativePath: '${const Uuid().v1()}.$fileExtension',
> validTill: DateTime.now().add(maxAge),
> );
```
Contributor guide
Assessment
This issue has not been assessed yet.