# HG changeset patch # User Goffi # Date 1599335957 -7200 # Node ID 886d1856e9de3157bb1c4bb9871cafd033744151 # Parent c74e5a488af6c82f3c054ab8c1f825c383f7037f pages (files/list): fixed empty dir handling diff -r c74e5a488af6 -r 886d1856e9de libervia/pages/files/list/page_meta.py --- 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)