From d6b0345ddb6723bf182df7b330a7d18b4c84984d Mon Sep 17 00:00:00 2001 From: Devon Hudson Date: Fri, 21 Jun 2024 08:51:00 -0600 Subject: [PATCH] Add ellipsis add end of truncated content fields --- sygnal/gcmpushkin.py | 2 +- tests/test_gcm.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/sygnal/gcmpushkin.py b/sygnal/gcmpushkin.py index e5d2dfaf..e8427365 100644 --- a/sygnal/gcmpushkin.py +++ b/sygnal/gcmpushkin.py @@ -708,7 +708,7 @@ def _build_data( if not isinstance(value, str): continue if len(value) > MAX_BYTES_PER_FIELD: - value = value[0:MAX_BYTES_PER_FIELD] + value = value[0 : MAX_BYTES_PER_FIELD - 3] + "..." data["content_" + attr] = value del data["content"] diff --git a/tests/test_gcm.py b/tests/test_gcm.py index 029c51bd..98cfa85f 100644 --- a/tests/test_gcm.py +++ b/tests/test_gcm.py @@ -548,7 +548,7 @@ def test_api_v1_large_fields(self) -> None: xxxxxxxxxxooooooooooxxxxxxxxxxooooooooooxxxxxxxxxxooooooooooxxxxxxxxxx\ ooooooooooxxxxxxxxxxooooooooooxxxxxxxxxxooooooooooxxxxxxxxxxoooooooooo\ xxxxxxxxxxooooooooooxxxxxxxxxxooooooooooxxxxxxxxxxooooooooooxxxxxxxxxx\ -ooooooooooxxxxxxxxxxooooooooooxxxxxxxxxxooooooooooxxxx", +ooooooooooxxxxxxxxxxooooooooooxxxxxxxxxxoooooooooox...", "room_id": "!slw48wfj34rtnrf:example.com", "prio": "high", "unread": "2",