Skip to content

Commit

Permalink
Add ellipsis add end of truncated content fields
Browse files Browse the repository at this point in the history
  • Loading branch information
devonh committed Jun 21, 2024
1 parent 56563d2 commit d6b0345
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion sygnal/gcmpushkin.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
2 changes: 1 addition & 1 deletion tests/test_gcm.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit d6b0345

Please sign in to comment.