You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if (cacheFile ==null|| cacheFile.validTill.isBefore(DateTime.now())) {
try {
awaitfor (final response
in _webHelper.downloadFile(url, key: key, authHeaders: headers)) {
if (response isDownloadProgress&& withProgress) {
streamController.add(response);
}
if (response isFileInfo) {
streamController.add(response);
}
}
} onObjectcatch (e) {
cacheLogger.log(
'CacheManager: Failed to download file from $url with error:\n$e',
CacheManagerLogLevel.debug);
if (cacheFile ==null&& streamController.hasListener) {
streamController.addError(e);
}
}
}
streamController.close();
Currently, in CacheManager._pushFileToStream when a cacheFile exists, the cached content is emitted, and if it is outdated, a network request is made to potentially update the file, and emit the updated content.
If a 404 happens on that request, the error is not added to the stream, and the cache is not evicted.
The error is only added if no cacheFile exists.
Expected behavior
On the 404, the cache is evicted (the server is telling us the resource no longer exists) and the error is added to the stream.
馃悰 Bug Report
Moving Baseflow/flutter_cached_network_image#898 to here.
flutter_cache_manager/flutter_cache_manager/lib/src/cache_manager.dart
Lines 137 to 157 in 32b71c1
Currently, in
CacheManager._pushFileToStream
when acacheFile
exists, the cached content is emitted, and if it is outdated, a network request is made to potentially update the file, and emit the updated content.If a
404
happens on that request, the error is not added to the stream, and the cache is not evicted.The error is only added if no
cacheFile
exists.Expected behavior
On the
404
, the cache is evicted (the server is telling us the resource no longer exists) and the error is added to the stream.Reproduction steps
See Baseflow/flutter_cached_network_image#898
Configuration
Version: 3.1.1
Platform:
Tested on macos but should affect all platforms
The text was updated successfully, but these errors were encountered: