Skip to content

Commit 0de33cd

Browse files
committed
Make image/svg+xml a text type
Fix #300
1 parent ea294f4 commit 0de33cd

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

lib/iruby/display.rb

+3
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ def ascii?(mime)
5656
# Special case for application/javascript.
5757
# This needs because mime-types tells us application/javascript a non-text type.
5858
true
59+
when "image/svg+xml"
60+
# mime-types tells us image/svg+xml a non-text type.
61+
true
5962
else
6063
MIME::Type.new(mime).ascii?
6164
end

test/iruby/mime_test.rb

+7
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,13 @@ class IRubyTest::MimeTest < IRubyTest::TestBase
1919
assert_equal(data,
2020
res["application/javascript"])
2121
end
22+
23+
test("image/svg+xml") do
24+
data = '<svg height="30" width="100"><text x="0" y="15" fill="red">SVG</text></svg>'
25+
res = IRuby::Display.display(data, mime: "image/svg+xml")
26+
assert_equal(data,
27+
res["image/svg+xml"])
28+
end
2229
end
2330
end
2431
end

0 commit comments

Comments
 (0)