Fix plain text messages newlines being ignored
This commit is contained in:
parent
717680bf0c
commit
d98b215c0f
4
TODO.md
4
TODO.md
|
@ -1,4 +1,7 @@
|
||||||
- Refactoring
|
- Refactoring
|
||||||
|
- Make all icon SVG files white/black, since we can now use ColorOverlay
|
||||||
|
- Make the icon blue in EditAccount when hovering and no avatar set
|
||||||
|
|
||||||
- Use HInterfaceBox for EditAccount Profile and Encryption
|
- Use HInterfaceBox for EditAccount Profile and Encryption
|
||||||
- HButton
|
- HButton
|
||||||
- Control: hovered, visualFocus, enaled
|
- Control: hovered, visualFocus, enaled
|
||||||
|
@ -91,7 +94,6 @@
|
||||||
- Spinner when loading account, past room events, images or clicking buttons
|
- Spinner when loading account, past room events, images or clicking buttons
|
||||||
- Show account page as loading until profile initially retrieved
|
- Show account page as loading until profile initially retrieved
|
||||||
- Theming
|
- Theming
|
||||||
- Make all icons white/black, since we can now use ColorOverlay
|
|
||||||
- Don't create additional lines in theme conversion (braces)
|
- Don't create additional lines in theme conversion (braces)
|
||||||
- Recursively merge default and user theme
|
- Recursively merge default and user theme
|
||||||
- Distribute fonts
|
- Distribute fonts
|
||||||
|
|
|
@ -510,7 +510,8 @@ class MatrixClient(nio.AsyncClient):
|
||||||
async def onRoomMessageText(self, room, ev) -> None:
|
async def onRoomMessageText(self, room, ev) -> None:
|
||||||
co = HTML_FILTER.filter(
|
co = HTML_FILTER.filter(
|
||||||
ev.formatted_body
|
ev.formatted_body
|
||||||
if ev.format == "org.matrix.custom.html" else html.escape(ev.body),
|
if ev.format == "org.matrix.custom.html" else
|
||||||
|
utils.plain2html(ev.body),
|
||||||
)
|
)
|
||||||
await self.register_nio_event(room, ev, content=co)
|
await self.register_nio_event(room, ev, content=co)
|
||||||
|
|
||||||
|
@ -518,7 +519,8 @@ class MatrixClient(nio.AsyncClient):
|
||||||
async def onRoomMessageEmote(self, room, ev) -> None:
|
async def onRoomMessageEmote(self, room, ev) -> None:
|
||||||
co = HTML_FILTER.filter_inline(
|
co = HTML_FILTER.filter_inline(
|
||||||
ev.formatted_body
|
ev.formatted_body
|
||||||
if ev.format == "org.matrix.custom.html" else html.escape(ev.body),
|
if ev.format == "org.matrix.custom.html" else
|
||||||
|
utils.plain2html(ev.body),
|
||||||
)
|
)
|
||||||
await self.register_nio_event(room, ev, content=co)
|
await self.register_nio_event(room, ev, content=co)
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import collections
|
import collections
|
||||||
|
import html
|
||||||
import xml.etree.cElementTree as xml_etree # FIXME: bandit warning
|
import xml.etree.cElementTree as xml_etree # FIXME: bandit warning
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from enum import auto as autostr
|
from enum import auto as autostr
|
||||||
|
@ -39,3 +40,7 @@ def guess_mime(file: IO) -> Optional[str]:
|
||||||
|
|
||||||
file.seek(0, 0)
|
file.seek(0, 0)
|
||||||
return filetype.guess_mime(file)
|
return filetype.guess_mime(file)
|
||||||
|
|
||||||
|
|
||||||
|
def plain2html(text: str) -> str:
|
||||||
|
return "<pre>%s</pre>" % html.escape(text)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user