aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Heinemeier Hansson <david@loudthinking.com>2006-03-02 01:54:53 +0000
committerDavid Heinemeier Hansson <david@loudthinking.com>2006-03-02 01:54:53 +0000
commit3fb29b172fb1ab0b84fd69747b62711ed5cdf4ca (patch)
treea5d8d18b5487dc7fcac1bbcd5eff51091c20d9de
parent4c5db2c7eac5fc7fe76e0c0cd12d8adf5b7ea4f1 (diff)
downloadrails-3fb29b172fb1ab0b84fd69747b62711ed5cdf4ca.tar.gz
rails-3fb29b172fb1ab0b84fd69747b62711ed5cdf4ca.tar.bz2
rails-3fb29b172fb1ab0b84fd69747b62711ed5cdf4ca.zip
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
-rw-r--r--actionpack/CHANGELOG2
-rw-r--r--actionpack/lib/action_view/helpers/asset_tag_helper.rb2
-rw-r--r--actionpack/test/template/asset_tag_helper_test.rb3
3 files changed, 5 insertions, 2 deletions
diff --git a/actionpack/CHANGELOG b/actionpack/CHANGELOG
index ca176ac92c..07f97bca6e 100644
--- a/actionpack/CHANGELOG
+++ b/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]
diff --git a/actionpack/lib/action_view/helpers/asset_tag_helper.rb b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
index a5687923b2..f05d9a096b 100644
--- a/actionpack/lib/action_view/helpers/asset_tag_helper.rb
+++ b/actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -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
diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb
index a4e1795b3e..bc7e3e0f7a 100644
--- a/actionpack/test/template/asset_tag_helper_test.rb
+++ b/actionpack/test/template/asset_tag_helper_test.rb
@@ -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