Closed octopop closed 8 months ago
If the pusher is set with format:'event_id_only' per the spec, no content is necessary and the pusher may omit it for any reason:
format:'event_id_only'
The content field from the event, if present. The pusher may omit this if the event had no content or for any other reason. https://spec.matrix.org/v1.9/push-gateway-api/#post_matrixpushv1notify
With above; Sygnal fails with error below. It needs to check if data["contents"] is not None before attempting to iterate over it.
if data["contents"] is not None
│ 2024-03-09 06:36:18,785 [1] DEBUG sygnal.http [f54170f3-1882-4626-b3fd-accc51c10842] Sending push to pushkin com.example.myappsynapsenotification for app ID com.example.myappiosynapsenotificatio │ │ 2024-03-09 06:36:18,786 [1] ERROR sygnal.http [f54170f3-1882-4626-b3fd-accc51c10842] Exception whilst dispatching notification. │ │ Traceback (most recent call last): │ │ File "/usr/local/lib/python3.10/site-packages/sygnal/http.py", line 275, in _handle_dispatch │ │ result = await pushkin.dispatch_notification(notif, d, context) │ │ File "/usr/local/lib/python3.10/site-packages/sygnal/notifications.py", line 217, in dispatch_notification │ │ return await self._dispatch_notification_unlimited(n, device, context) │ │ File "/usr/local/lib/python3.10/site-packages/sygnal/gcmpushkin.py", line 523, in _dispatch_notification_unlimited │ │ data = GcmPushkin._build_data(n, device, self.api_version) │ │ File "/usr/local/lib/python3.10/site-packages/sygnal/gcmpushkin.py", line 676, in _build_data │ │ for attr, value in data["content"].items(): │ │ AttributeError: 'NoneType' object has no attribute 'items'
If the pusher is set with
format:'event_id_only'
per the spec, no content is necessary and the pusher may omit it for any reason:With above; Sygnal fails with error below. It needs to check
if data["contents"] is not None
before attempting to iterate over it.