Skip to content

Fix MIME::Type.new error #361

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/iruby/display.rb
Original file line number Diff line number Diff line change
Expand Up @@ -106,14 +106,15 @@ def protect(mime, data)
# but mime-types library tells us it is a non-text type.
FORCE_TEXT_TYPES = Set[
"application/javascript",
"image/svg+xml"
"image/svg+xml",
"text.html",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

MIME Types must have a / in the string. Was the intention to add text/html here?

].freeze

def ascii?(mime)
if FORCE_TEXT_TYPES.include?(mime)
true
else
MIME::Type.new("content-type" => mime).ascii?
MIME::Types[mime].first.ascii?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think both the new and old line would be sufficient here, but why change if it works?

end
end

Expand Down
Loading