Permalink
Browse files

Merge pull request #3237 from sakuro/data-url-scheme

Support data: url scheme

Conflicts:
	actionpack/lib/action_view/asset_paths.rb
  • Loading branch information...
1 parent 9b40f5c commit 2ef29ef9af8634999b8b615ef1643ab630bc59d8 @rafaelfranca rafaelfranca committed May 13, 2012
View
2 actionpack/lib/action_view/asset_paths.rb
@@ -4,7 +4,7 @@
module ActionView
class AssetPaths #:nodoc:
- URI_REGEXP = %r{^[-a-z]+://|^cid:|^//}
+ URI_REGEXP = %r{^[-a-z]+://|^(?:cid|data):|^//}
attr_reader :config, :controller
View
2 actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -389,7 +389,7 @@ def image_tag(source, options={})
src = options[:src] = path_to_image(source)
- unless src =~ /^cid:/
+ unless src =~ /^(?:cid|data):/
options[:alt] = options.fetch(:alt){ image_alt(src) }
end
View
3 actionpack/test/template/asset_tag_helper_test.rb
@@ -205,7 +205,8 @@ def teardown
%(image_tag("//www.rubyonrails.com/images/rails.png")) => %(<img alt="Rails" src="//www.rubyonrails.com/images/rails.png" />),
%(image_tag("mouse.png", :mouseover => "/images/mouse_over.png")) => %(<img alt="Mouse" onmouseover="this.src='/images/mouse_over.png'" onmouseout="this.src='/images/mouse.png'" src="/images/mouse.png" />),
%(image_tag("mouse.png", :mouseover => image_path("mouse_over.png"))) => %(<img alt="Mouse" onmouseover="this.src='/images/mouse_over.png'" onmouseout="this.src='/images/mouse.png'" src="/images/mouse.png" />),
- %(image_tag("mouse.png", :alt => nil)) => %(<img src="/images/mouse.png" />)
+ %(image_tag("mouse.png", :alt => nil)) => %(<img src="/images/mouse.png" />),
+ %(image_tag("data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==", :alt => nil)) => %(<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" />),
}
FaviconLinkToTag = {

0 comments on commit 2ef29ef

Please sign in to comment.