Bug 329875 - KTP doesn’t recognize well URL patterns
Summary: KTP doesn’t recognize well URL patterns
Status: RESOLVED FIXED
Alias: None
Product: telepathy
Classification: Frameworks and Libraries
Component: text-ui (show other bugs)
Version: 0.7.0
Platform: unspecified Linux
: NOR normal
Target Milestone: 0.8.0
Assignee: Telepathy Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2014-01-12 13:57 UTC by ariasuni
Modified: 2014-02-27 17:37 UTC (History)
3 users (show)

See Also:
Latest Commit:
Version Fixed In: 0.8.0


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description ariasuni 2014-01-12 13:57:16 UTC
According to RFC 3986, «In practice, URIs are delimited in a variety of ways, but usually within double-quotes "http://example.com/", angle brackets <http://example.com/>» (<http://tools.ietf.org/html/rfc3986#appendix-C>).

When I put "http://example.com" or <http://example.com> in the chat, the created link include the " or >, which break the link (guess how it’s annoying to edit URL each time).

It also put a semicolon if the last character (the first doesn’t matter) is " or >, which is useless, weird, and personally is not what I want, it totally break the flow of my sentence.

Reproducible: Always



Expected Results:  
KTP should:
– Recognize "http://example.com" and <http://example.com>, and they should respectively translate to (HTML): "<a href="http://example.com">http://example.com</a>" and &lt;<a href="http://example.com">http://example.com</a>&gt;.
– never put a semicolon at the end of a link.
Comment 1 Martin Klapetek 2014-01-12 14:41:24 UTC
We're using Konversation's parsing, CC'ing its developer for input.
Comment 2 Eike Hein 2014-01-12 14:43:33 UTC
I don't think you are anymore (Konversation has no problems with the above).
Comment 3 Martin Klapetek 2014-01-12 14:52:30 UTC
Hah, I'm pretty sure we didn't change anything. Maybe it's related to us using a webview for the conversation (and where the links are displayed).

Ok, will investigate.
Comment 4 David Edmundson 2014-02-27 15:42:30 UTC
Confirmed.
Right in konvi, wrong here.

Not sure why.
Comment 5 Martin Klapetek 2014-02-27 15:43:39 UTC
Confirming this issue, we can reproduce.
Comment 6 Martin Klapetek 2014-02-27 17:37:05 UTC
Git commit a7df31b729f85cb7381263789010b6bc4aba9e88 by Martin Klapetek.
Committed on 27/02/2014 at 17:36.
Pushed by mklapetek into branch 'master'.

Merge escape and URL filters into one

This is needed to avoid the URL filter detecting wrong link boundaries
as the escape filter would change eg. "<http://kde.org/>" to
&lt;http://kde.org/&gt; and then the URL filter would detect
"http://kde.org/&gt" as the actual link.

Switching the order wouldn't help because the escape filter would escape
the newly inserted <a href...> links and the user would
get &lt;a href.../a&gt; and no clickable links.

Therefore we first detect the links, replace them with placeholders,
then escape everything, then replace placeholders with actual links.

Reviewed-by: David Edmundson
FIXED-IN: 0.8.0

M  +0    -1    KTp/CMakeLists.txt
M  +53   -1    KTp/message-escape-filter.cpp
M  +2    -1    KTp/message-processor.cpp
D  +0    -60   KTp/message-url-filter.cpp

http://commits.kde.org/telepathy-common-internals/a7df31b729f85cb7381263789010b6bc4aba9e88