mirror of
https://github.com/sdsykes/fastimage.git
synced 2025-10-07 00:04:52 -04:00
add support for doctype in SVG
This commit is contained in:
parent
921ed9a580
commit
2b4b69d80e
@ -491,7 +491,7 @@ class FastImage
|
||||
:webp if @stream.peek(12)[8..11] == "WEBP"
|
||||
when "<s"
|
||||
:svg
|
||||
when "<?"
|
||||
when /<[?!]/
|
||||
# Peek 10 more chars each time, and if end of file is reached just raise
|
||||
# unknown. We assume the <svg tag cannot be within 10 chars of the end of
|
||||
# the file, and is within the first 250 chars.
|
||||
|
2
test/fixtures/test4.svg
vendored
Normal file
2
test/fixtures/test4.svg
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="271px" height="271px" version="1.1" content="<mxfile userAgent="Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/59.0.3071.115 Safari/537.36" version="7.0.2" editor="www.draw.io"><diagram id="5c6b87c6-fc3f-dea4-eb59-9250f69f05c2" name="Page-1">jZJNb4MwDIZ/Te5AVHW7lnXrZScOO6fEkGiBoBBG2K9fIA4fqiqNC87z+ku2Cc0b92FYJz41B0WyhDtC30iWpSd69r+ZTEjSVxpIbSRHtoFC/gLCBOkgOfQHR6u1srI7wlK3LZT2wJgxejy6VVodq3ashgdQlEw90i/JrQj05ZRs/AayFrFymqByZ+V3bfTQYj2S0Wr5gtywmAv9e8G4HneIXgnNjdY2WI3LQc3DjWMLce9P1LVvA639T0AWAn6YGiB2vPRlpzgL32I3m+B8xgvXw31RUv8YhbRQdKycwehvwTNhG4Uy67uwnEo68AUvWAyMBfe04XQdg78v0A1YM3kXDKDxROJpxZ2M256yMzKx29EKGd5Gvebe5uMNHFF8bqtYtN3B0+sf</diagram></mxfile>" style="background-color: rgb(255, 255, 255);"><defs/><g transform="translate(0.5,0.5)"><rect x="0" y="0" width="270" height="270" fill="#ffffff" stroke="#000000" pointer-events="none"/><rect x="2" y="2" width="266" height="266" fill="#ffffff" stroke="#000000" pointer-events="none"/></g></svg>
|
After Width: | Height: | Size: 1.2 KiB |
@ -33,7 +33,8 @@ GoodFixtures = {
|
||||
"test.svg" => [:svg, [200, 300]],
|
||||
"test_partial_viewport.svg" => [:svg, [860, 400]],
|
||||
"test2.svg" => [:svg, [366, 271]],
|
||||
"test3.svg" => [:svg, [255, 48]]
|
||||
"test3.svg" => [:svg, [255, 48]],
|
||||
"test4.svg" => [:svg, [271, 271]]
|
||||
}
|
||||
|
||||
BadFixtures = [
|
||||
@ -152,7 +153,7 @@ class FastImageTest < Test::Unit::TestCase
|
||||
assert_equal info[1], FastImage.size(File.join(FixturePath, fn))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_should_report_content_length_correctly_for_local_files
|
||||
assert_equal 3296, FastImage.new(File.join(FixturePath, "test.bmp")).content_length
|
||||
end
|
||||
@ -386,7 +387,7 @@ class FastImageTest < Test::Unit::TestCase
|
||||
FastImage.type("data:", :raise_on_failure => true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test_should_work_with_domains_with_underscores
|
||||
assert_equal :gif, FastImage.type("http://foo_bar.inbro.net/images/p.gif")
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user