nheko icon indicating copy to clipboard operation
nheko copied to clipboard

Code sections are broken when copying due to invalid HTML escapes being inserted

Open ell1e opened this issue 2 years ago • 0 comments

Describe the bug

See steps to reproduce

To Reproduce

  1. Enter the following markdown in nheko as a message and hit send:
    ```
    test1&2
    ```
    
  2. Click right-click > copy on the message, and paste in something like gedit or kate or notepad:
    ```
    test1&2
    ```
    
  3. This is clearly different code, and if you try to send that again it'll also look different and if people copy it out from a rendered markdown document it'll be the wrong code. The escape shouldn't be there, at the very least not inside code sections.

What happened?

Incorrect invalid HTML escapes inserted into markdown code fence sections when copying the message. Because code sections treat the contents as literal, this changes the code in the section and essentially corrupts the message.

Expected behavior

No invalid HTML escapes inserted into markdown code fence sections.

Screenshots

No response

Version

0.11.3-d27e42d

Operating system

Linux

Installation method

Flathub

Qt version

No response

C++ compiler

No response

Desktop Environment

No response

Did you use profiles?

  • [ ] Profiles used?

Relevant log output

No response

Backtrace

No response

ell1e avatar Nov 25 '23 15:11 ell1e