This project is archived and is in readonly mode.
auto_link helper incorrectly parses URIs with ampersands (&s)
Reported by Mannie | April 6th, 2010 @ 12:50 PM
Comments and changes to this ticket
-
Mannie April 6th, 2010 @ 01:49 PM
here is a patch :)
From: http://railsforum.com/viewtopic.php?id=14293
ActionView::Helpers::TextHelper::AUTO_LINK_RE = %r{
(<a\s.*?>.*??| # Opening <a> tag.. and any other text including html tags which might be before a url [^\w]| # or, first char before url ^ # or, start of line
) (
(?:https?://)? # optional protocol (?:[-\w]+\.)+ # subdomain/domain parts (?:com|net|org|[a-z][a-z]|edu|gov|biz|int|mil|info|name|museum|coop|aero) # TLD (?::\d+)? # Optional port (?:/(?:(?:[~\w\+@%=-]|(?:[,.;:][^\s$]))+)?)* # Path (?:\?[\w\+@%&=.;-]+)? # Query String ?foo=bar (?:\#[\w\-]*)? # Anchor
) (
(?:[^\w]|$) # Trailing Character
) }xi
ActionView::Helpers::TextHelper.module_eval do
def auto_link_urls(text, href_options = {})extra_options = tag_options(href_options.stringify_keys) || "" text.gsub(ActionView::Helpers::TextHelper::AUTO_LINK_RE) do all, leading, url, trailing = $&, $1, $2, $3 if leading =~ /<a\s/i # don't replace URL's that are already linked all else text = block_given? ? yield(url) : url url = 'http://' + url unless url =~ /^https?:\/\// %(#{leading}<a href="#{url}"#{extra_options}>#{text}</a>#{trailing}) end end
end end
-
José Valim April 10th, 2010 @ 12:49 PM
Could you please provide a patch according to the guidelines specified on the contributors guide?
http://rails.lighthouseapp.com/projects/8994/sending-patches
Thanks!
-
David Trasbo April 15th, 2010 @ 07:04 PM
- Assigned user set to Ryan Bigg
This ticket can be marked as incomplete until a patch is provided.
-
Ryan Bigg April 15th, 2010 @ 11:00 PM
- State changed from new to incomplete
-
Ryan Bigg November 3rd, 2010 @ 04:00 AM
- State changed from incomplete to stale
- Importance changed from to Low
This ticket is 6 months old. Marking as stale. If you wish for this issue to be fixed then please provide a patch.
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>