mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-23 01:06:21 +01:00
Filter out invalid files
This commit is contained in:
parent
679c0dbae2
commit
368a6a6755
1 changed files with 14 additions and 5 deletions
|
@ -60,7 +60,7 @@ class FileWebdavDataSource implements FileDataSource {
|
|||
final xml = XmlDocument.parse(response.body);
|
||||
final files = WebdavFileParser()(xml);
|
||||
// _log.fine("[list] Parsed files: [$files]");
|
||||
return files.map((e) {
|
||||
return files.where((element) => _validateFile(element)).map((e) {
|
||||
if (e.metadata == null || e.metadata.fileEtag == e.etag) {
|
||||
return e;
|
||||
} else {
|
||||
|
@ -328,10 +328,14 @@ class FileAppDbDataSource implements FileDataSource {
|
|||
if (results?.isNotEmpty == true) {
|
||||
final entries = results
|
||||
.map((e) => AppDbFileEntry.fromJson(e.cast<String, dynamic>()));
|
||||
return entries.map((e) {
|
||||
_log.info("[_doList] ${e.path}[${e.index}]");
|
||||
return e.data;
|
||||
}).reduce((value, element) => value + element);
|
||||
return entries
|
||||
.map((e) {
|
||||
_log.info("[_doList] ${e.path}[${e.index}]");
|
||||
return e.data;
|
||||
})
|
||||
.reduce((value, element) => value + element)
|
||||
.where((element) => _validateFile(element))
|
||||
.toList();
|
||||
} else {
|
||||
throw CacheNotFoundException("No entry: $path");
|
||||
}
|
||||
|
@ -720,4 +724,9 @@ Future<void> _cacheListResults(
|
|||
}
|
||||
}
|
||||
|
||||
bool _validateFile(File f) {
|
||||
// See: https://gitlab.com/nkming2/nc-photos/-/issues/9
|
||||
return f.lastModified != null;
|
||||
}
|
||||
|
||||
final _log = Logger("entity.file.data_source");
|
||||
|
|
Loading…
Reference in a new issue