Mercurial > libervia-backend
diff libervia/backend/plugins/plugin_xep_0048.py @ 4264:3fbd1a1285c1
plugin XEP-0048: don't fail if a type is missing in bookmark data.
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 12 Jun 2024 22:36:15 +0200 |
parents | 5f2d496c633f |
children | 0d7bb4df2343 |
line wrap: on
line diff
--- a/libervia/backend/plugins/plugin_xep_0048.py Wed Jun 12 22:35:13 2024 +0200 +++ b/libervia/backend/plugins/plugin_xep_0048.py Wed Jun 12 22:36:15 2024 +0200 @@ -443,7 +443,13 @@ bookmarks_ori = getattr(client, "bookmarks_" + _storage_location) if bookmarks_ori is None: return ret - data = bookmarks_ori[type_] + try: + data = bookmarks_ori[type_] + except KeyError: + log.warning( + f"{type_!r} missing in {storage_location} storage." + ) + data = bookmarks_ori[type_] = {} for bookmark in data: if type_ == XEP_0048.MUC_TYPE: ret[_storage_location][bookmark.full()] = data[bookmark].copy()