Skip to content
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

Fix MIME::Type.new error #361

Closed
wants to merge 3 commits into from
Closed

Fix MIME::Type.new error #361

wants to merge 3 commits into from

Conversation

mackross
Copy link

No description provided.

@kojix2
Copy link
Member

kojix2 commented Jan 24, 2025

I'm sorry, but if you don't mind, could you explain a little more about your situation and purpose when you made this pull request?

@sealocal
Copy link
Contributor

Agree - there is no description, explanation, or use case provided, so this should be closed. It can be re-opened if explanation is provided.

@mackross
Copy link
Author

The way mine types work in newer standard library appears to have changed. I got exceptions when trying to display HTML without using this as the current usage is deprecated.

@sealocal
Copy link
Contributor

As-is, this PR fails all of the CI workflows.

What changed about the mime-types? Can you provide any references to that?

Can you provide repro steps to see the error message?

@mackross
Copy link
Author

mackross commented Feb 10, 2025 via email

].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?

@@ -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?

@sealocal
Copy link
Contributor

Closing as there is no clear motivation or direction here. Anyone, please re-open if you want to pick it up.

@sealocal sealocal closed this Feb 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants