GNOME Bugzilla – Bug 489452
ampersand entity in links is not converted to ampersand
Last modified: 2007-10-24 15:28:28 UTC
<html> <body> <a href="http://www.example.com/?b&c">b&c</a> </body> </html> Expected results: - would display a link with b&c as content - clicking on it would bring http://www.example.com/?b&c Actual results: - display a link with b&c as content - clicking on it brings http://www.example.com/?b&c Note ampersand entities in other document parts are correctly displayed. Even more surprising the link content is displayed correctly if the <a> tag doesn't include a href attribute.
It is caused by the fix applied to bug 270487.
Created attachment 97755 [details] [review] inspect for entity Look further in the string when determining the token will be handled as an HTML entity; also remove special casing for links added as a fix to bug 270487 since it is no longer necessary.
I cannot find it now, but I saw somewhere a "rule" to always escape amps in urls, even in href attribute. Which means, when user enters url http://a.b.c/e?f=g&h=i in a composer, then in HTML mail in href should be http://a.b.c/e?f=g&h=i which your patch doesn't do. Anyway, there is previous bug about same issue, so marking this as duplicate. btw, you've right it caused bug you mentioned, but I think we can leave it there, only improve a bit other logic. *** This bug has been marked as a duplicate of 485700 ***
I don't see how the patch attached to bug 485700 will fix the first problem I noted, " - would display a link with b&c as content". Note the actual bug is not just about "&" but with all entities; they are kept as is when used in a <a href="whatever"> tag. I am only concerned about the rendering part, which that other patch doesn't fix. Easy test: <html><body><a href="http://whatever">a b</a></body></html> Will render as a link with a b as text content with that other patch.
Thanks for testing, I uploaded new version of the patch, which fixes it. BTW, we should discuss any issues about that patch rather in that opened bug.