ScanDir should not scan our remote storage

This commit is contained in:
Ming Ming 2021-05-24 01:22:22 +08:00
parent 15e1591622
commit 7b8ed4885d
2 changed files with 7 additions and 3 deletions

View file

@ -2,7 +2,7 @@ import 'package:nc_photos/account.dart';
import 'package:nc_photos/api/api_util.dart' as api_util;
String getRemoteAlbumsDir(Account account) =>
"${_getRemoteStorageDir(account)}/albums";
"${getRemoteStorageDir(account)}/albums";
String _getRemoteStorageDir(Account account) =>
String getRemoteStorageDir(Account account) =>
"${api_util.getWebdavRootUrlRelative(account)}/.com.nkming.nc_photos";

View file

@ -3,6 +3,7 @@ import 'package:logging/logging.dart';
import 'package:nc_photos/account.dart';
import 'package:nc_photos/entity/file.dart';
import 'package:nc_photos/exception.dart';
import 'package:nc_photos/remote_storage_util.dart' as remote_storage_util;
import 'package:nc_photos/use_case/ls.dart';
import 'package:path/path.dart' as path;
@ -20,7 +21,10 @@ class ScanDir {
return;
}
yield items.where((element) => element.isCollection != true).toList();
for (final i in items.where((element) => element.isCollection == true)) {
for (final i in items.where((element) =>
element.isCollection == true &&
!element.path
.endsWith(remote_storage_util.getRemoteStorageDir(account)))) {
yield* this(account, i);
}
} on CacheNotFoundException catch (e) {