morethanwords / tweb

Telegram Web K, GPL v3
https://web.telegram.org/k/
GNU General Public License v3.0
1.87k stars 599 forks source link

[BUG] Multiline Code Blocks not sent as code blocks #32

Closed Ferdi265 closed 3 years ago

Ferdi265 commented 3 years ago

Describe the bug When sending a message containing a multiline codeblock using the triple backtick (```) syntax, the code block renders correctly in the sending client, but receiving clients (and WebK on reload of the page) don't see the message formatted as a code block (formatting sequences such as ** and __ are correctly not interpreted though, unlike WebZ).

To Reproduce Steps to reproduce the behavior:

  1. Send a message containing a triple backtick code block
  2. Observe that the message looks correct on the sending client
  3. Observe that the message looks incorrect on the receiving client
  4. Observe that the message is also incorrect when reloading the page on the sending client

Expected behavior Messages with code blocks should correctly be sent as such and be seen the same by all participants

Screenshots

Sent message: sent-message

Sender-Side Appearance (before reload): sender-appearance-before

Sender-Side Appearance (after reload): sender-appearance-after

Receiver-Side Appearance: receiver-appearance

Desktop (please complete the following information):

Additional context I suspect the problem is that the message metadata for the formatting is not correctly added when sending the message, which explains why it works client-side until the page is reloaded (and the message is restored from storage)

morethanwords commented 3 years ago

Thank you for the report! The bug was in sending text with whitespace. Should be fixed now.

Ferdi265 commented 3 years ago

Thank you for the fix. Which version of WebK will contain the fix?

Currently I can still reproduce this on WebK alpha 0.7.2. Will the fix be in 0.7.3?

morethanwords commented 3 years ago

It should be in 0.7.2. What kind of formatting did you try?

https://user-images.githubusercontent.com/25210241/131045686-0a8c86ed-a438-4bfe-914a-60836fc4cdee.mp4

Ferdi265 commented 3 years ago

Huh, I could swear I was able to reproduce this a second ago. It seems to be correctly fixed now, still displays 0.7.2. Whatever that was, thank you for the fix, it works quite well now :)