Baseflow / Baseflow/flutter_cache_manager

CacheManager saves files with the same path

Abierto
#397 2 comentarios 0 reacciones 0 asignados Ver en GitHub
Lenguaje dominante
Dart
Estrellas
809
Forks
510
Merge medio
6 min
PR fusionados (30 d)
1

Descripción

## 🐛 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),
> );
```

Guía de contribución

Abrir la guía de contribución

Línea de trabajo

Read flutter_cache_manager-3.3.0/lib/src/cache_manager.dart, focusing on putFile and putFileStream and how relativePath is encoded. Confirm that concurrent image writes no longer receive the same path, and that scheduled cleanup can delete the resulting files without a FileSystemException.

Escrito por el modelo de indexación a partir del texto del issue.

Evaluación

Stack tecnológico
dart, flutter
Área
backend
Tipo de issue
Error
Dificultad
2/5
Tiempo estimado
1-3 horas
Estado de actividad
Estancado
Claridad
Bien especificado
Aptitud para principiantes
48/100

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.