diff options
author | Michael Koziarski <michael@koziarski.com> | 2008-01-27 01:10:48 +0000 |
---|---|---|
committer | Michael Koziarski <michael@koziarski.com> | 2008-01-27 01:10:48 +0000 |
commit | 10aa728e8ba423e43fb96fa234309819e1a99574 (patch) | |
tree | c5924295150ce464e283a7d097c56684bc2ae491 /actionpack/lib | |
parent | 5ac3a9bd0b4cfd6aa7ad585ae6dde206c2e32bb0 (diff) | |
download | rails-10aa728e8ba423e43fb96fa234309819e1a99574.tar.gz rails-10aa728e8ba423e43fb96fa234309819e1a99574.tar.bz2 rails-10aa728e8ba423e43fb96fa234309819e1a99574.zip |
Don't repeatedly add relative_url_root to asset sources. Closes #10767 [tomtoday, Koz]
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@8740 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
Diffstat (limited to 'actionpack/lib')
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_tag_helper.rb | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb index 12fbbb0dd6..883cd31373 100644 --- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb @@ -450,9 +450,11 @@ module ActionView else source = "/#{dir}/#{source}" unless source[0] == ?/ if has_request - source = "#{@controller.request.relative_url_root}#{source}" + unless source =~ %r{^#{@controller.request.relative_url_root}/} + source = "#{@controller.request.relative_url_root}#{source}" + end end - rewrite_asset_path!(source) + source = rewrite_asset_path(source) if include_host host = compute_asset_host(source) @@ -504,11 +506,15 @@ module ActionView end end - # Break out the asset path rewrite so you wish to put the asset id + # Break out the asset path rewrite in case plugins wish to put the asset id # someplace other than the query string. - def rewrite_asset_path!(source) + def rewrite_asset_path(source) asset_id = rails_asset_id(source) - source << "?#{asset_id}" if !asset_id.blank? + if asset_id.blank? + source + else + source + "?#{asset_id}" + end end def javascript_src_tag(source, options) |