mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Skip complete URLs
git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@4099 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
This commit is contained in:
parent
91383e0426
commit
2cc9b21c07
2 changed files with 6 additions and 1 deletions
|
@ -152,7 +152,7 @@ module ActionView
|
|||
def compute_public_path(source, dir, ext)
|
||||
source = "/#{dir}/#{source}" unless source.first == "/" || source.include?(":")
|
||||
source << ".#{ext}" unless source.split("/").last.include?(".")
|
||||
source << '?' + rails_asset_id(source) if defined?(RAILS_ROOT)
|
||||
source << '?' + rails_asset_id(source) if defined?(RAILS_ROOT) && %r{^[-a-z]+://} !~ source
|
||||
source = "#{@controller.request.relative_url_root}#{source}" unless %r{^[-a-z]+://} =~ source
|
||||
source = ActionController::Base.asset_host + source unless source.include?(":")
|
||||
source
|
||||
|
|
|
@ -125,6 +125,11 @@ class AssetTagHelperTest < Test::Unit::TestCase
|
|||
expected_time = File.stat(File.expand_path(File.dirname(__FILE__) + "/../fixtures/public/images/rails.png")).mtime.to_i.to_s
|
||||
assert_equal %(<img alt="Rails" src="/images/rails.png?#{expected_time}" />), image_tag("rails.png")
|
||||
end
|
||||
|
||||
def test_skipping_asset_id_on_complete_url
|
||||
Object.send(:const_set, :RAILS_ROOT, File.dirname(__FILE__) + "/../fixtures/")
|
||||
assert_equal %(<img alt="Rails" src="http://www.example.com/rails.png" />), image_tag("http://www.example.com/rails.png")
|
||||
end
|
||||
|
||||
def test_preset_asset_id
|
||||
Object.send(:const_set, :RAILS_ROOT, File.dirname(__FILE__) + "/../fixtures/")
|
||||
|
|
Loading…
Reference in a new issue