Browse files

Don't prepend the asset host if the string is already a fully-qualifi…

…ed URL

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@2430 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 11de947 commit 1e08d11579f0080f086a6bfea1693826a0c09c95 @jamis jamis committed Sep 30, 2005
View
2 actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Don't prepend the asset host if the string is already a fully-qualified URL
+
* Updated to script.aculo.us V1.5.0_rc2 and Prototype to V1.4.0_pre7 [Thomas Fuchs]
* Undo condition change made in [2345] to prevent normal parameters arriving as StringIO.
View
3 actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -131,7 +131,8 @@ def compute_public_path(source, dir, ext)
source = "/#{dir}/#{source}" unless source.first == "/" || source.include?(":")
source = "#{source}.#{ext}" unless source.include?(".")
source = "#{@controller.request.relative_url_root}#{source}" unless %r{^[-a-z]+://} =~ source
- ActionController::Base.asset_host + source
+ source = ActionController::Base.asset_host + source unless source.include?(":")
+ source
end
end
end
View
10 actionpack/test/template/asset_tag_helper_test.rb
@@ -196,4 +196,14 @@ def test_image_tag
assert_nothing_raised { image_tag('') }
end
+ def test_stylesheet_with_asset_host_already_encoded
+ ActionController::Base.asset_host = "http://foo.example.com"
+ result = stylesheet_link_tag("http://bar.example.com/stylesheets/style.css")
+ assert_dom_equal(
+ %(<link href="http://bar.example.com/stylesheets/style.css" media="screen" rel="Stylesheet" type="text/css" />),
+ result)
+ ensure
+ ActionController::Base.asset_host = ""
+ end
+
end

0 comments on commit 1e08d11

Please sign in to comment.