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
This commit is contained in:
David Heinemeier Hansson 2006-03-02 01:54:53 +00:00
parent 4c5db2c7ea
commit 3fb29b172f
3 changed files with 5 additions and 2 deletions

View File

@ -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 File

@ -146,7 +146,7 @@ module ActionView
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 File

@ -76,7 +76,8 @@ class AssetTagHelperTest < Test::Unit::TestCase
%(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