Baseflow / Baseflow/flutter_cache_manager

CacheManager saves files with the same path

Đang mở
#397 2 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Dart
Star
809
Fork
510
Merge trung bình
6 phút
Pull request đã merge (30 ngày)
1

Mô tả

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

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

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.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
dart, flutter
Lĩnh vực
backend
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Đình trệ
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
48/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.