mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-23 09:16:19 +01:00
Fix ListAlbum exception if dir does not exist
This commit is contained in:
parent
394864e8ae
commit
1102ffd67c
1 changed files with 11 additions and 2 deletions
|
@ -247,8 +247,17 @@ class ListAlbumBloc extends Bloc<ListAlbumBlocEvent, ListAlbumBlocState> {
|
|||
}
|
||||
|
||||
final shareRepo = ShareRepo(ShareRemoteDataSource());
|
||||
final shares = await shareRepo.listDir(ev.account,
|
||||
File(path: remote_storage_util.getRemoteAlbumsDir(ev.account)));
|
||||
var shares = <Share>[];
|
||||
try {
|
||||
shares = await shareRepo.listDir(ev.account,
|
||||
File(path: remote_storage_util.getRemoteAlbumsDir(ev.account)));
|
||||
} on ApiException catch(e) {
|
||||
if (e.response.statusCode == 404) {
|
||||
// Normal when album dir is not created yet
|
||||
} else {
|
||||
rethrow;
|
||||
}
|
||||
}
|
||||
final items = albums.map((e) {
|
||||
final isSharedByMe = shares.any((element) =>
|
||||
element.path.trimAny("/") == e.albumFile!.strippedPath);
|
||||
|
|
Loading…
Reference in a new issue