mirror of
https://gitlab.com/nkming2/nc-photos.git
synced 2025-01-23 17:26:18 +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 shareRepo = ShareRepo(ShareRemoteDataSource());
|
||||||
final shares = await shareRepo.listDir(ev.account,
|
var shares = <Share>[];
|
||||||
|
try {
|
||||||
|
shares = await shareRepo.listDir(ev.account,
|
||||||
File(path: remote_storage_util.getRemoteAlbumsDir(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 items = albums.map((e) {
|
||||||
final isSharedByMe = shares.any((element) =>
|
final isSharedByMe = shares.any((element) =>
|
||||||
element.path.trimAny("/") == e.albumFile!.strippedPath);
|
element.path.trimAny("/") == e.albumFile!.strippedPath);
|
||||||
|
|
Loading…
Reference in a new issue