Mercurial > libervia-backend
changeset 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 | 2109d864a3e7 |
children | 2417ad1d0f23 |
files | libervia/backend/plugins/plugin_xep_0048.py |
diffstat | 1 files changed, 7 insertions(+), 1 deletions(-) [+] |
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()