Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

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

Support data: url scheme
  • Loading branch information...
commit a74b6a023b851a7382fccf6373404bb16205745d 2 parents e7f8f5f + c57aec5
@rafaelfranca rafaelfranca authored
View
2  actionpack/lib/action_view/asset_paths.rb
@@ -37,7 +37,7 @@ def compute_source_path(source, dir, ext)
end
def is_uri?(path)
- path =~ %r{^[-a-z]+://|^cid:|^//}
+ path =~ %r{^[-a-z]+://|^(?:cid|data):|^//}
end
private
View
2  actionpack/lib/action_view/helpers/asset_tag_helper.rb
@@ -348,7 +348,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
@@ -164,7 +164,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 = {
Please sign in to comment.
Something went wrong with that request. Please try again.