Mercurial > libervia-web
changeset 1349:886d1856e9de
pages (files/list): fixed empty dir handling
author | Goffi <goffi@goffi.org> |
---|---|
date | Sat, 05 Sep 2020 21:59:17 +0200 |
parents | c74e5a488af6 |
children | a32f3f47e4a8 |
files | libervia/pages/files/list/page_meta.py |
diffstat | 1 files changed, 16 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/libervia/pages/files/list/page_meta.py Sat Sep 05 21:59:14 2020 +0200 +++ b/libervia/pages/files/list/page_meta.py Sat Sep 05 21:59:17 2020 +0200 @@ -97,9 +97,22 @@ # parent dir affiliation # TODO: some caching? What if affiliation changes? - affiliations = await self.host.bridgeCall( - "FISAffiliationsGet", service.full(), "", str(path), profile - ) + try: + affiliations = await self.host.bridgeCall( + "FISAffiliationsGet", service.full(), "", str(path), profile + ) + except BridgeException as e: + if e.condition == 'item-not-found': + log.debug( + f'"item-not-found" received for {path} at {service}, this may indicate ' + f'that the location is new') + # FIXME: Q&D handling of empty dir (e.g. new directory/photos album) + affiliations = { + session_data.jid.userhost(): "owner" + } + else: + raise e + directory_affiliation = affiliations.get(session_data.jid.userhost()) if directory_affiliation == "owner": # we need to transtype dict items to str because with some bridges (D-Bus)