Bug 488325

Summary: Neochat doesn't render html character
Product: [Applications] NeoChat Reporter: Tobias Fella <fella>
Component: GeneralAssignee: Tobias Fella <fella>
Status: RESOLVED FIXED    
Severity: normal CC: carl, james.h.graham
Priority: NOR    
Version First Reported In: git master   
Target Milestone: ---   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed/Implemented In:
Sentry Crash Report:

Description Tobias Fella 2024-06-10 20:14:20 UTC
with this event, neochat shows the escape sequences in the code block instead of the characters that are supposed to be shown

{
    "content": {
        "body": "> <@deepbluev7:neko.dev> !sh cat /dev/aliases\n\nExited with code 1 in 48.0 ms. **stderr:**\n\n```\n\ncat: can't open '/dev/aliases': No such file or directory\n\n```",
        "format": "org.matrix.custom.html",
        "formatted_body": "<mx-reply><blockquote><a href='https://matrix.to/#/!urandom, version 9️⃣:maunium.net/$IjtPTuHjTcHrnJf5IkIuQXn8m_lzzVQ7VLAcLVLbquY'>In reply to</a> <a href='https://matrix.to/#/@deepbluev7:neko.dev'>@deepbluev7:neko.dev</a><br/>!sh cat /dev/aliases</blockquote></mx-reply><p>Exited with code 1 in 48.0 ms. <strong>stderr:</strong></p>\n<pre><code>\ncat: can&#x27;t open &#x27;/dev/aliases&#x27;: No such file or directory\n</code></pre>\n",
        "m.relates_to": {
            "m.in_reply_to": {
                "event_id": "$IjtPTuHjTcHrnJf5IkIuQXn8m_lzzVQ7VLAcLVLbquY"
            }
        },
        "msgtype": "m.notice"
    },
    "event_id": "$Xox7yliP7yj8bTcpP3pAbMCdqfKsEEP6Mhzr8rA5b1k",
    "origin_server_ts": 1718049530356,
    "sender": "@urandom:maunium.net",
    "type": "m.room.message",
    "unsigned": {
    }
}
Comment 1 James Graham 2024-07-23 13:42:54 UTC
Hmm, not sure on this one. We treat everything in a code block as plain text because it should be. So unless we did that it's a bug with the client that sent it.

It would be impossible to consistently figure out when we should or shouldn't convert these someone for example may intentionally want to send the escape sequences to be viewed. Treating as plain text is the only sane way to work.
Comment 2 James Graham 2024-07-23 13:59:07 UTC
Actually thinking about it we should
Comment 3 Bug Janitor Service 2024-07-23 14:05:54 UTC
A possibly relevant merge request was started @ https://invent.kde.org/network/neochat/-/merge_requests/1818
Comment 4 James Graham 2024-07-23 17:27:03 UTC
Git commit 11475259a180aec98022f905be59420870078c8f by James Graham.
Committed on 23/07/2024 at 17:27.
Pushed by nvrwhere into branch 'master'.

Make sure that apostrophes are unescaped when visualising messages

Title

M  +1    -0    autotests/texthandlertest.cpp
M  +1    -0    src/texthandler.cpp

https://invent.kde.org/network/neochat/-/commit/11475259a180aec98022f905be59420870078c8f