This project is archived and is in readonly mode.

#3591 ✓resolved
Kostas K.

auto_link should not create a link inside a link which has the rel attribute

Reported by Kostas K. | December 17th, 2009 @ 09:44 AM

auto_link gets confused when the a tag has something more than the href attribute and relinks inner html of the link

>> a = "<a href=\"\" rel=\"nofollow\"></a>"
=> "<a href=\"\" rel=\"nofollow\"></a>"
>> auto_link(a)
=> "<a href=\"\" rel=\"nofollow\"><a href=\"\"></a></a>"
>> auto_link(a.gsub(/\srel\="nofollow"/, ""))
=> "<a href=\"\"></a>"

sadly enough, I have fixed it locally but can't manage to submit a patch since I can't run the tests (and don't really have much time right now, might try to build a patch next week or something) but here is what seems like it helps a bit:

diff text_helper.rb  text_helper_modified.rb 
<             if left =~ /<[^>]+$/ && right =~ /^[^>]*>/
>             if (left =~ /<[^>]+$/ && right =~ /^[^>]*>/) || (left =~ /<a\b[^>]+>$/i && right =~ /^<\/a>/i)

Comments and changes to this ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile »

<h2 style="font-size: 14px">Tickets have moved to Github</h2>

The new ticket tracker is available at <a href=""></a>


Referenced by