This project is archived and is in readonly mode.
auto_link helper incorrectly parses URIs with ampersands (&s)
-
Mannie
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 endend end
-
José Valim
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
- Assigned user set to Ryan Bigg
This ticket can be marked as incomplete until a patch is provided.
-
Ryan Bigg
- State changed from new to incomplete
-
Ryan Bigg
- 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.