whatwg / mimesniff

MIME Sniffing Standard

Home Page:https://mimesniff.spec.whatwg.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The "archive" MIME type definition excludes some "zip" MIME types.

nuno-andre opened this issue · comments

In 4.6. MIME type groups, ZIP is defined as having an application/zip essence or a zip suffix.

In the following paragraph, archive is described as having application/zip, application/x-rar-compressed or application/x-gzip as an essence, but no mention is made of the zip suffix.

Maybe a definition similar to that of scriptable would be clearer:

An archive MIME type is a ZIP-based MIME type or any MIME type whose essence is one of the following:

  • application/x-rar-compressed
  • application/x-gzip

<p>An <dfn export>archive MIME type</dfn> is any <a>MIME type</a> whose
<!--<span>type</span> is equal to "<code title>archive</code>" or-->
<a for="MIME type">essence</a> is one of the following:
<ul class="brief">
<li><code>application/x-rar-compressed</code>
<li><code>application/zip</code>
<li><code>application/x-gzip</code>
</ul>

You are correct that the archive MIME type definition does not include the full ZIP-based MIME type definition. It is possible that that was an oversight, but it's also possible that it wasn't.

ZIP-based MIME type is not actually used anywhere in the spec, and archive MIME type is only used as part of the archive type pattern matching algorithm. This algorithm, as written, is never going to detect a MIME type with an essence having a +zip suffix, so it is potentially unnecessary to include such a MIME type in the definition of archive MIME type.

(I'll leave it to someone else to make a final determination.)

So archive type is somewhat of a misnomer, because .zip files are indeed archives, but .gz isn't. Maybe compressed type would be a more appropriate name?

Cheers!