Permalink
Browse files

Fixed that default image extension was not appended when using a full…

… URL with AssetTagHelper#image_tag (closes #4032, #3728) [rubyonrails@beautifulpixel.com]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@3740 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
  • Loading branch information...
1 parent 4c5db2c commit 3fb29b172fb1ab0b84fd69747b62711ed5cdf4ca @dhh dhh committed Mar 2, 2006
View
2 actionpack/CHANGELOG
@@ -1,5 +1,7 @@
*SVN*
+* Fixed that default image extension was not appended when using a full URL with AssetTagHelper#image_tag #4032, #3728 [rubyonrails@beautifulpixel.com]
+
* Added that page caching will only happen if the response code is less than 400 #4033 [g.bucher@teti.ch]
* Add ActionController::IntegrationTest to allow high-level testing of the way the controllers and routes all work together [Jamis Buck]
View
2 actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -146,7 +146,7 @@ def image_tag(source, options = {})
private
def compute_public_path(source, dir, ext)
source = "/#{dir}/#{source}" unless source.first == "/" || source.include?(":")
- source = "#{source}.#{ext}" unless source.include?(".")
+ source = "#{source}.#{ext}" unless source.split("/").last.include?(".")
source = "#{@controller.request.relative_url_root}#{source}" unless %r{^[-a-z]+://} =~ source
source = ActionController::Base.asset_host + source unless source.include?(":")
source
View
3 actionpack/test/template/asset_tag_helper_test.rb
@@ -76,7 +76,8 @@ def relative_url_root
%(image_tag("xml")) => %(<img alt="Xml" src="/images/xml.png" />),
%(image_tag("rss", :alt => "rss syndication")) => %(<img alt="rss syndication" src="/images/rss.png" />),
%(image_tag("gold", :size => "45x70")) => %(<img alt="Gold" height="70" src="/images/gold.png" width="45" />),
- %(image_tag("symbolize", "size" => "45x70")) => %(<img alt="Symbolize" height="70" src="/images/symbolize.png" width="45" />)
+ %(image_tag("symbolize", "size" => "45x70")) => %(<img alt="Symbolize" height="70" src="/images/symbolize.png" width="45" />),
+ %(image_tag("http://www.rubyonrails.com/images/rails")) => %(<img alt="Rails" src="http://www.rubyonrails.com/images/rails.png" />)
}
def test_auto_discovery

0 comments on commit 3fb29b1

Please sign in to comment.