Weight not respected
justinlittman opened this issue · 0 comments
justinlittman commented
My apologies if my understanding of freedesktop.org.xml
/ mimemagic is incorrect, but mimemagic appears not to respect weight when looking up a mimetype by extension.
With the latest freedesktop.org.xml
:
MimeMagic.by_path("spec/fixtures/test2/00000001.html").type
"application/xhtml+xml"
While "application/xhtml+xml" appears first in the file, "text/html" has a higher weight:
<glob pattern="*.html" weight="80"/>
<glob pattern="*.htm" weight="80"/>
vs.
<glob pattern="*.xhtml"/>
<glob pattern="*.xht"/>
<glob pattern="*.html"/>
<glob pattern="*.htm"/>
Interestingly, when using the circleci/ruby:2.7.2-node
image, the expected result was produced as this image has an older version of freedesktop.org.xml
in which the mimes were sorted differently.
Thanks in advance for your assistance.