-
Notifications
You must be signed in to change notification settings - Fork 27.4k
Linky filter breaks with certain input #8945
Comments
Problem exists in 1.2.21 and 1.3.0-rc.0. |
It looks like |
Handle the double quote character as part of the domain in email addresses Closes angular#8945
That commit doesn't really solve the problem, it will still make this into a link:
It should simply not even see this as a valid email address. A double quote shouldn't be part of an email address right? Shouldn't it simply be removed from the LINKY_URL_REGEXP? |
Hm the Syntax part of http://en.wikipedia.org/wiki/Email_address just told me that a double quote can indeed be part of the local part of an email address. It seems that the LINKY_URL_REGEXP is much too simple, and needs to be split into 2 different regexes, one for links and one for email addresses. Clearly |
Another issue:
|
@kevinrenskers have you tried since 1.3.0-beta.19? I believe that should be fixed by a9d2271 |
Ah, the link surrounded by quotes in indeed solved in rc-0, but |
I'm not sure what DLog is --- but I agree with you that the regexp is very simple and not really adequate for some cases. However, I think it's probably good enough for most cases, and it would be much more complicated to allow in an html context (how do we decide whether it's supposed to be |
I'm using linky in a chat application and At the very least have a try/catch that returns an empty string or something? And a better regex that catches only valid links and emailaddresses would be most welcome. Of course it's supposed to be |
I would say that for our chat application the severity is critical, since the entire chat is broken is someone types something that linky sees as a link but then the sanitizer breaks on. |
yes, it's not ideal --- are you using linky on its own without the rest of sanitize? |
With the rest. |
what I mean is basically, are you rendering the output of the page with ngBindHtml + $sanitize, or just filtering the output through linky |
ng-bind-html + linky (plus some other for using emoticons and stuff). |
@kevinrenskers I'm pretty much in the same boat as you are (IRC web frontend). However, the case of quote-enlosed URLs is not entirely fixed -- it still breaks for URLs enclosed in |
I now have to remember to put the fixes back in after updating AngularJS and the Sanitize module. This is the current version I'm using:
|
Email addresses can (under certain restrictions) include double quote characters. See http://tools.ietf.org/html/rfc3696#section-3. For example, `"Jo Bloggs"@abc.com` is a valid email address. When serializing emails to the `href` attribute of an anchor element, we must HTML encode these double quote characters. See http://www.w3.org/TR/html-markup/syntax.html#syntax-attr-double-quoted This commit does not attempt to improve the functionality (i.e. regex) that attempts to identify email addresses in a general string. Closes #8945 Closes #8964 Closes #5946 Closes #10090 Closes #9256
For example, when the input is
DLog("%@",url)
then you'll get this error:[$sanitize:badparse] The sanitizer was unable to parse the following block of html: <a href="mailto:%@",url">%@",url</a>
Example here: http://plnkr.co/edit/AnEumWvCjXRQ4GROh578?p=preview
The text was updated successfully, but these errors were encountered: