Baseflow / Baseflow/flutter_cache_manager

CacheManager saves files with the same path

オープン
#397 コメント 2 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Dart
スター
809
フォーク
510
平均マージ
6分
マージ済み PR(30日)
1

説明

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

コントリビューションガイド

コントリビューションガイドを開く

調査の方向性

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.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
dart, flutter
領域
backend
issue の種類
バグ
難易度
2/5
見積もり時間
1〜3時間
活発さ
停滞
明瞭さ
明確に書かれている
初心者へのやさしさ
48/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。