This project is archived and is in readonly mode.
Running autolink on text containing a mailto: link breaks
Reported by marek | February 3rd, 2009 @ 11:01 PM | in 3.x
ActionView::Helpers::TextHelper#autolink does not handle certain mailto: links properly.
Assume the following html:
<a href="mailto:david@loudthinking.com">Mail me</a>
When running this html through autolink, it should not alter the html. However it is transformed to:
<a href="mailto:<a href="david@loudthinking.com">david@loudthinking.com</a>">Mail me</a>
I wrote a test to reproduce this bug and added a fix as well. See: http://github.com/mdh/rails/comm...
Comments and changes to this ticket
-
marek February 3rd, 2009 @ 11:07 PM
- no changes were found...
-
Amos King February 4th, 2009 @ 03:12 AM
- Tag changed from ruby 1.8.7, actionview, auto_link, bug, edge, text_helper to ruby 1.8.7, actionview, auto_link, bug, edge, patch, text_helper
+1
-
Michael Koziarski February 6th, 2009 @ 12:59 AM
That patch isn't a patch ;)
But more fundamentally, does the other auto_link functionality support already linked text? I didn't see it looking at the tests but perhaps I'm missing it.
If it does, then let's pull that kind of test into a new test case for both emails and urls.
-
marek February 6th, 2009 @ 09:06 AM
Oops,
Please excuse me for screwing up. I added a proper diff file this time.
I guess this feature is not often used.
But yes, there is such a test in text_helper_test.rb. It's called test_auto_link_already_linked. I've expanded that test so it covers this issue too, please see patch.
-
marek February 18th, 2009 @ 09:17 AM
Very much related to this issue:
If the html contains an img tag it gets screwed up too. I fixed that as well. See second patch file.
-
Mislav March 11th, 2009 @ 10:46 AM
The second issue (IMG tag) was resolved in #1523.
I'm attaching a patch that takes the same approach as that ticket for the first issue you reported. It's very similar to your patch, only it handles all cases of email strings found inside HTML attributes.
-
marek March 11th, 2009 @ 11:09 AM
Thanks for taking the time to look at my patch. I was not aware of #1523. Using the same approach makes sense.
-
Mislav April 17th, 2010 @ 05:37 AM
- Tag changed from ruby 1.8.7, actionview, auto_link, bug, edge, patch, text_helper to actionview, auto_link, patch
I've pushes two patches which resolve all auto_link issues in this tracker. Changes are in the "auto_link" branch of my fork
-
Mislav April 17th, 2010 @ 05:53 AM
I've just pushed 2-3-stable compatible version. The branch name is "auto_link_2-3-stable"
-
Repository May 29th, 2010 @ 03:06 AM
- State changed from new to resolved
(from [17b4fd25e4de8f05d40ccaa776e51636745aa8e8]) avoid auto_linking already linked emails; more robust detection of linked URLs
References #1523 [#1862 state:resolved] [#3591 state:resolved]
Add test that shows how link text can contain HTML if needed:
the trick is using block form in combination withraw
.
Let link text be automatically HTML-escaped[#2017 state:resolved] http://github.com/rails/rails/commit/17b4fd25e4de8f05d40ccaa776e516...
-
Repository May 29th, 2010 @ 03:06 AM
(from [8f0b2138ee979799092e0489f7298289c90901b9]) avoid auto_linking already linked emails; more robust detection of linked URLs
References #1523 [#1862 state:resolved] [#3591 state:resolved]
Add test that shows how link text can contain HTML if needed:
the trick is using block form in combination withraw
.
Let link text be automatically HTML-escaped[#2017 state:resolved] http://github.com/rails/rails/commit/8f0b2138ee979799092e0489f72982...
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="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>
Attachments
Tags
Referenced by
- 2017 Should not html_escape auto_link block form I've added my auto_link patches to #1862
- 1862 Running autolink on text containing a mailto: link breaks References #1523 [#1862 state:resolved] [#3591 state:reso...
- 2017 Should not html_escape auto_link block form References #1523 [#1862 state:resolved] [#3591 state:reso...
- 3591 auto_link should not create a link inside a link which has the rel attribute References #1523 [#1862 state:resolved] [#3591 state:reso...
- 1862 Running autolink on text containing a mailto: link breaks References #1523 [#1862 state:resolved] [#3591 state:reso...
- 3591 auto_link should not create a link inside a link which has the rel attribute References #1523 [#1862 state:resolved] [#3591 state:reso...
- 2017 Should not html_escape auto_link block form References #1523 [#1862 state:resolved] [#3591 state:reso...