Fix handling topics containing \n, \t or <text>

This commit is contained in:
miruka 2020-06-02 22:03:22 -04:00
parent 6772f14c24
commit a6529b040c
3 changed files with 7 additions and 2 deletions

View File

@ -83,6 +83,9 @@ and this project adheres to
- When signing in a new account, correctly position it after the other - When signing in a new account, correctly position it after the other
existing ones without needing a restart existing ones without needing a restart
- Correctly handle room topics containing new lines, hard tabs or text inside
`<>` brackets
## 0.5.0 ## 0.5.0
### Added ### Added

View File

@ -1276,7 +1276,9 @@ class MatrixClient(nio.AsyncClient):
avatar_url = room.gen_avatar_url or "", avatar_url = room.gen_avatar_url or "",
plain_topic = room.topic or "", plain_topic = room.topic or "",
topic = HTML.filter( topic = HTML.filter(
room.topic or "", inline=True, room_id=room.room_id, utils.plain2html(room.topic or ""),
inline = True,
room_id = room.room_id,
), ),
inviter_id = inviter, inviter_id = inviter,
inviter_name = room.user_name(inviter) if inviter else "", inviter_name = room.user_name(inviter) if inviter else "",

View File

@ -451,7 +451,7 @@ class NioCallbacks:
) -> None: ) -> None:
if ev.topic: if ev.topic:
topic = HTML_PROCESSOR.filter( topic = HTML_PROCESSOR.filter(
ev.topic, inline=True, room_id=room.room_id, plain2html(ev.topic), inline=True, room_id=room.room_id,
) )
co = f"%1 changed the room's topic to \"{topic}\"" co = f"%1 changed the room's topic to \"{topic}\""
else: else: