Skip to content
This repository
Browse code

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

Support data: url scheme

Conflicts:
	actionpack/lib/action_view/asset_paths.rb
  • Loading branch information...
commit 2ef29ef9af8634999b8b615ef1643ab630bc59d8 1 parent 9b40f5c
Rafael Mendonça França rafaelfranca authored
2  actionpack/lib/action_view/asset_paths.rb
@@ -4,7 +4,7 @@
4 4
5 5 module ActionView
6 6 class AssetPaths #:nodoc:
7   - URI_REGEXP = %r{^[-a-z]+://|^cid:|^//}
  7 + URI_REGEXP = %r{^[-a-z]+://|^(?:cid|data):|^//}
8 8
9 9 attr_reader :config, :controller
10 10
2  actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -389,7 +389,7 @@ def image_tag(source, options={})
389 389
390 390 src = options[:src] = path_to_image(source)
391 391
392   - unless src =~ /^cid:/
  392 + unless src =~ /^(?:cid|data):/
393 393 options[:alt] = options.fetch(:alt){ image_alt(src) }
394 394 end
395 395
3  actionpack/test/template/asset_tag_helper_test.rb
@@ -205,7 +205,8 @@ def teardown
205 205 %(image_tag("//www.rubyonrails.com/images/rails.png")) => %(<img alt="Rails" src="//www.rubyonrails.com/images/rails.png" />),
206 206 %(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" />),
207 207 %(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" />),
208   - %(image_tag("mouse.png", :alt => nil)) => %(<img src="/images/mouse.png" />)
  208 + %(image_tag("mouse.png", :alt => nil)) => %(<img src="/images/mouse.png" />),
  209 + %(image_tag("data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==", :alt => nil)) => %(<img src="data:image/gif;base64,R0lGODlhAQABAID/AMDAwAAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw==" />),
209 210 }
210 211
211 212 FaviconLinkToTag = {

0 comments on commit 2ef29ef

Please sign in to comment.
Something went wrong with that request. Please try again.