From b0c39f38463cb5b1bd6474eb07a976d7cea446fa Mon Sep 17 00:00:00 2001 From: Charlie Calendre <57274151+c-cal@users.noreply.github.com> Date: Fri, 8 Mar 2024 13:55:47 +0100 Subject: [PATCH 1/2] Check if `data["content"]` is a dict before using it as a dict --- sygnal/gcmpushkin.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sygnal/gcmpushkin.py b/sygnal/gcmpushkin.py index 1177c0aa..621c2fd7 100644 --- a/sygnal/gcmpushkin.py +++ b/sygnal/gcmpushkin.py @@ -669,7 +669,7 @@ def _build_data( data[attr] = data[attr][0:MAX_BYTES_PER_FIELD] if api_version is APIVersion.V1: - if "content" in data: + if isinstance(data.get("content"), dict): for attr, value in data["content"].items(): if not isinstance(value, str): continue From 5c23c88ab7fed7db9db8a128a9afbe772e24ed23 Mon Sep 17 00:00:00 2001 From: "Olivier Wilkinson (reivilibre)" Date: Thu, 21 Mar 2024 17:45:41 +0000 Subject: [PATCH 2/2] Add newsfile --- changelog.d/362.bugfix | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/362.bugfix diff --git a/changelog.d/362.bugfix b/changelog.d/362.bugfix new file mode 100644 index 00000000..a3d3a394 --- /dev/null +++ b/changelog.d/362.bugfix @@ -0,0 +1 @@ +Fix a bug causing Sygnal to fail when processing notifications without a `content` dict, when those notifications were destined for GCM. Contributed by @c-cal.