aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/lib/action_view/helpers/asset_url_helper.rb
diff options
context:
space:
mode:
authorJoshua Peek <josh@joshpeek.com>2012-10-15 13:30:24 -0500
committerJoshua Peek <josh@joshpeek.com>2012-10-15 13:30:24 -0500
commitc4276ddf3860128d4f64c795c8b5cf5258aaeab8 (patch)
tree040169c0411e2acc0bdc95ffecff952fd2219202 /actionpack/lib/action_view/helpers/asset_url_helper.rb
parent046ab843b84db1935047dbc796f5acae66c45a42 (diff)
downloadrails-c4276ddf3860128d4f64c795c8b5cf5258aaeab8.tar.gz
rails-c4276ddf3860128d4f64c795c8b5cf5258aaeab8.tar.bz2
rails-c4276ddf3860128d4f64c795c8b5cf5258aaeab8.zip
Ignore asset url query string or anchor when appending extensions and computing public path
Diffstat (limited to 'actionpack/lib/action_view/helpers/asset_url_helper.rb')
-rw-r--r--actionpack/lib/action_view/helpers/asset_url_helper.rb4
1 files changed, 3 insertions, 1 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_url_helper.rb b/actionpack/lib/action_view/helpers/asset_url_helper.rb
index d75e4c0edc..0bb5e739bb 100644
--- a/actionpack/lib/action_view/helpers/asset_url_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_url_helper.rb
@@ -122,6 +122,8 @@ module ActionView
return "" unless source.present?
return source if source =~ URI_REGEXP
+ tail, source = source[/([\?#].+)$/], source.sub(/([\?#].+)$/, '')
+
if extname = compute_asset_extname(source, options)
source = "#{source}#{extname}"
end
@@ -140,7 +142,7 @@ module ActionView
source = "#{host}#{source}"
end
- source
+ "#{source}#{tail}"
end
alias_method :path_to_asset, :asset_path # aliased to avoid conflicts with a asset_path named route