Baseflow / Baseflow/flutter_cache_manager
CacheManager saves files with the same path
- Lingua principale
- Dart
- Stelle
- 809
- Fork
- 510
- Merge medio
- 6m
- PR unite (30g)
- 1
Descrizione
## 🐛 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),
> );
```
Guida per i contributori
Apri la guida per i contributori
Direzione di ricerca
Leggi flutter_cache_manager-3.3.0/lib/src/cache_manager.dart, concentrandoti su putFile e putFileStream e sul modo in cui viene codificato relativePath. Conferma che le scritture concorrenti di immagini non ricevano più lo stesso percorso e che la pulizia pianificata possa eliminare i file risultanti senza una FileSystemException.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- dart, flutter
- Ambito
- backend
- Tipo di issue
- Bug
- Difficoltà
- 2/5
- Tempo stimato
- 1-3 ore
- Stato di attività
- Ferma
- Chiarezza
- Specificata chiaramente
- Idoneità per principianti
- 48/100