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

Algorithm for determining what is and is not a MIME type seems to be undefined. #194

Open
MattMenke2 opened this issue Sep 10, 2024 · 4 comments

Comments

@MattMenke2
Copy link

MattMenke2 commented Sep 10, 2024

What is the issue with the MIME Sniffing Standard?

The section "Interpreting the resource metadata" / "To determine the supplied MIME type of a resource" has the step: "If supplied-type is not a MIME type, the supplied MIME type is undefined."

The "MIME type" link doesn't define how to determine whether a string is or is not a MIME type. Does it mean if the "parsing a MIME type" algorithm returns failure, or something else?

@GPHemsley
Copy link
Member

It seems that this lack of clarity occurred in cc81ec4 (#36), where the term "parsable MIME type" was removed, perhaps because the focus of the algorithm is on determining where to get the MIME type from rather than what it means. I'm not entirely sure what the intention is now.

@annevk Can you comment?

@nektro
Copy link

nektro commented Sep 14, 2024

in practice the list could be any mix of:
https://www.iana.org/assignments/media-types/media-types.xhtml
https://developer.mozilla.org/en-US/docs/Web/HTTP/Basics_of_HTTP/MIME_types/Common_types
https://pagure.io/mailcap/blob/master/f/mime.types

ive also conglomerated as many as i can find into
https://github.com/nektro/zig-mime/blob/main/mime.zig

@MattMenke2
Copy link
Author

nektro: I don't believe the spec requires it to be a known MIME type, just one that's theoretically valid.

@annevk
Copy link
Member

annevk commented Sep 16, 2024

I don't think removing "parsable MIME type" really changed matters here as that had a rather recursive definition.

https://mimesniff.spec.whatwg.org/#interpreting-the-resource-metadata probably needs to invoke https://fetch.spec.whatwg.org/#concept-header-extract-mime-type and in the cases where the variable remains null, the step quoted in OP applies. And the variable should never be assigned to anything but null or a MIME type.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

4 participants