matrix-org / sygnal

Sygnal: reference Push Gateway for Matrix
Apache License 2.0
153 stars 139 forks source link

Check if `data["content"]` is a dict before using it as a dict #362

Closed c-cal closed 3 months ago

c-cal commented 4 months ago

Fix https://github.com/matrix-org/sygnal/issues/363

image

When notification does not contain the "content" field, then None is used by default: https://github.com/matrix-org/sygnal/blob/c8a85fd3e9009ff21a79089a4f3524cc0e310024/sygnal/notifications.py#L95

This happens with pusher that have the attribute data.format: event_id_only, such as Element Android (https://github.com/element-hq/element-android/blob/develop/vector/src/main/java/im/vector/app/core/pushers/PushersManager.kt#L85), or when Synapse is configured with push.include_content: false.

Signed-off-by: Charlie Calendre