diff options
author | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-06-16 17:27:53 -0700 |
---|---|---|
committer | Rafael Mendonça França <rafaelmfranca@gmail.com> | 2013-06-16 17:27:53 -0700 |
commit | 0117f28b980e5f2d68ff9ff5862f3fdb0216e2a0 (patch) | |
tree | 1738867b5c15c00206fda3dc209837fafb6ee84a | |
parent | 0f89689b2357f39da52515b83391db58689a1361 (diff) | |
parent | 8fc3427646e932c3a1fb9f9794364866f030595e (diff) | |
download | rails-0117f28b980e5f2d68ff9ff5862f3fdb0216e2a0.tar.gz rails-0117f28b980e5f2d68ff9ff5862f3fdb0216e2a0.tar.bz2 rails-0117f28b980e5f2d68ff9ff5862f3fdb0216e2a0.zip |
Merge pull request #10969 from davidcelis/case-insensitive-asset-path
Use a case insensitive URI Regexp for #asset_path
-rw-r--r-- | actionpack/lib/action_view/helpers/asset_url_helper.rb | 2 | ||||
-rw-r--r-- | actionpack/test/template/asset_tag_helper_test.rb | 7 |
2 files changed, 6 insertions, 3 deletions
diff --git a/actionpack/lib/action_view/helpers/asset_url_helper.rb b/actionpack/lib/action_view/helpers/asset_url_helper.rb index b5f2df76ab..0b957adb91 100644 --- a/actionpack/lib/action_view/helpers/asset_url_helper.rb +++ b/actionpack/lib/action_view/helpers/asset_url_helper.rb @@ -105,7 +105,7 @@ module ActionView # ) # module AssetUrlHelper - URI_REGEXP = %r{^[-a-z]+://|^(?:cid|data):|^//} + URI_REGEXP = %r{^[-a-z]+://|^(?:cid|data):|^//}i # Computes the path to asset in public directory. If :type # options is set, a file extension will be appended and scoped diff --git a/actionpack/test/template/asset_tag_helper_test.rb b/actionpack/test/template/asset_tag_helper_test.rb index 8d0ab7fd81..214a13654e 100644 --- a/actionpack/test/template/asset_tag_helper_test.rb +++ b/actionpack/test/template/asset_tag_helper_test.rb @@ -48,6 +48,9 @@ class AssetTagHelperTest < ActionView::TestCase %(asset_path("style.min")) => %(/style.min), %(asset_path("style.min.css")) => %(/style.min.css), + %(asset_path("http://www.outside.com/image.jpg")) => %(http://www.outside.com/image.jpg), + %(asset_path("HTTP://www.outside.com/image.jpg")) => %(HTTP://www.outside.com/image.jpg), + %(asset_path("style", type: :stylesheet)) => %(/stylesheets/style.css), %(asset_path("xmlhr", type: :javascript)) => %(/javascripts/xmlhr.js), %(asset_path("xml.png", type: :image)) => %(/images/xml.png) @@ -445,8 +448,8 @@ class AssetTagHelperTest < ActionView::TestCase [nil, '/', '/foo/bar/', 'foo/bar/'].each do |prefix| assert_equal 'Rails', image_alt("#{prefix}rails.png") assert_equal 'Rails', image_alt("#{prefix}rails-9c0a079bdd7701d7e729bd956823d153.png") - assert_equal 'Long file name with hyphens', image_alt("#{prefix}long-file-name-with-hyphens.png") - assert_equal 'Long file name with underscores', image_alt("#{prefix}long_file_name_with_underscores.png") + assert_equal 'Long file name with hyphens', image_alt("#{prefix}long-file-name-with-hyphens.png") + assert_equal 'Long file name with underscores', image_alt("#{prefix}long_file_name_with_underscores.png") end end |