threema-web icon indicating copy to clipboard operation
threema-web copied to clipboard

Wrong trailing semicolon on URL

Open tafli opened this issue 2 years ago • 3 comments

Bug Description

I recognized this behavior when sharing CURL-Request.

When sending a URL with a trailing '/' or sub path and trailing single quote ('), the text appears with an additional ; at the end in Threema-Web. On a mobile app (tested on Android only), the text appears correctly.

Examples: 'foo.bar -> 'foo.bar 'foo.bar' -> 'foo.bar' 'foo.bar/' -> 'foo.bar/'; 'foo.bar/x' -> 'foo.bar/x';

The leading ' doesn't need to exist. foo.bar/x' has the same effect.

It also works, when trailing the ' with additional ;. In this case a ; is added as well: foo.bar/x';;; -> foo.bar/x';;;;

Using the copy function, the correct text is copied without the trailing ;.

Steps to Reproduce (for bugs)

Send following text: foo.bar/x'

Expected behaviour

Sent text is shown correctly.

Your Environment

  • Threema Web version: 2.4.1

tafli avatar Jun 13 '22 14:06 tafli

Can reproduce this issue using Firefox 101.0.1 and MS Edge 102.0.1245.39

bratkartoffel avatar Jun 13 '22 14:06 bratkartoffel

Confirmed. This is an interaction between HTML escaping and the linkify filter... The text first gets converted into foo.bar/x&#039; then into <a href="http://foo.bar/x&#039" class="autolinked autolinked-url" target="_blank" rel="noopener noreferrer">foo.bar/x&#039</a>;.

threema-danilo avatar Jun 14 '22 12:06 threema-danilo

Hmm, this one is tricky. We generally want to do HTML escaping first, before applying other filters. However, this causes some issues with autolinker, see https://github.com/gregjacobs/Autolinker.js/issues/197. I can't yet promise a quick solution, especially since you are the first person that reports this issue in the 5 years since it was released 🙂 If someone has a good idea of how to solve this, PRs are welcome.

threema-danilo avatar Jun 14 '22 13:06 threema-danilo