Skip to content
This repository was archived by the owner on Apr 12, 2024. It is now read-only.

Linky filter ignores invalid URL characters #13699

Open
dchacke opened this issue Jan 7, 2016 · 2 comments
Open

Linky filter ignores invalid URL characters #13699

dchacke opened this issue Jan 7, 2016 · 2 comments

Comments

@dchacke
Copy link

dchacke commented Jan 7, 2016

I tried to parse links in a string and I noticed that the links got way too long because they only ever stopped when a space was encountered. In my case, they should have stopped earlier at an escaped quote (\"), but I suppose there should be other special characters that properly delimit a URL from the rest of the string.

This example includes my specific case where I tried to parse some stringified JSON and the recognized link is too long. I also put some special characters in there that should not be allowed, which I base on http://stackoverflow.com/a/1547940/1371131.

I parsed the text using the following expression:

<pre><code ng-bind-html="object | json | linky: '_blank'"></code></pre>

Forgive me if my reproduction of the regex is wrong. I haven't used regexes much, nor do I know much about the exact regex format URLs need to follow, so take it with a grain of salt. The issue I encountered seemed weird though.

@Narretz
Copy link
Contributor

Narretz commented Jan 15, 2016

Thanks for the detailed explanation. The linky regex is currently pretty weak. The thing is that I'm not sure if \ is really disallowed. The same SO question has an answer where it is said, that \ is "unwise" but not forbidden. In any case, I don't really want to complicate the linky regex too much .... I wonder what @gkalpak's opinion is on this, he has recently dealt with the mail regex.

@Narretz Narretz added this to the Ice Box milestone Jan 15, 2016
@gkalpak
Copy link
Member

gkalpak commented Jan 20, 2016

Yes, the LINKY_URL_REGEXP seems pretty broken. Not sure how much of it can be fixed without breaking existing apps. I'll look into it some more...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants