Bug 384968

Summary: Only first 10 links in a message shown properly, additional links become copies of the 2nd link
Product: [Unmaintained] telepathy Reporter: Dennis Schridde <heri+kde>
Component: text-uiAssignee: Alexandr Akulich <akulichalexander>
Status: RESOLVED FIXED    
Severity: normal CC: akulichalexander
Priority: NOR    
Version: unspecified   
Target Milestone: Future   
Platform: Other   
OS: Linux   
Latest Commit: Version Fixed In: 18.12.3
Sentry Crash Report:

Description Dennis Schridde 2017-09-22 17:26:42 UTC
When I send the following message via XMPP using KDE Telepathy, only the first 10 links are displayed properly, link no. 11 and following will become copies of the 2nd link.

What I sent and what arrives in the message archive on the server (XMPP MAM):
```
Test
http://01.org/
http://02.org/
http://03.org/
http://04.org/
http://05.org/
http://06.org/
http://07.org/
http://08.org/
http://09.org/
http://10.org/
http://11.org/
http://12.org/
http://13.org/
http://14.org/
```

What KDE Telepathy displays:
```
Test
http://01.org/
http://02.org/
http://03.org/
http://04.org/
http://05.org/
http://06.org/
http://07.org/
http://08.org/
http://09.org/
http://10.org/
http://02.org/0
http://02.org/1
http://02.org/2
http://02.org/3
```

I am using KDE Telepathy 17.08.1 with Telepathy Gabble 0.18.4 and Telepathy Logger 0.8.2.
Comment 1 Alexandr Akulich 2019-03-02 00:30:06 UTC
Still reproducible on 18.12.1 (with telepathy-morse/Telegram).

I'll try to fix it :)
Comment 2 Alexandr Akulich 2019-03-02 15:28:54 UTC
https://phabricator.kde.org/D19477
Comment 3 Alexandr Akulich 2019-03-03 22:46:29 UTC
Git commit 5c77cc29db5966a7ef227f20da8d54a264f28746 by Alexander Akulich.
Committed on 03/03/2019 at 22:45.
Pushed by akulichalexandr into branch 'Applications/18.12'.

Fix escape/url filter URL placeholder backward substitution

The placeholder ends with a decimal URL index. The substitution is an
incremental pass from zero index, so when the placeholder is substituted
back to URL the replacing code matches incomplete index and we got a
messed URLs.

(Replace of `#K#T#P1` messes up `#K#T#P10` and `#K#T#P11`)

Add a end marker to the placeholder scheme to never mess URL.
FIXED-IN: 18.12.3

Differential Revision: https://phabricator.kde.org/D19477

M  +1    -1    KTp/message-escape-filter.cpp

https://commits.kde.org/ktp-common-internals/5c77cc29db5966a7ef227f20da8d54a264f28746