Closed casperisfine closed 11 months ago
Ah, on TruffleRuby as well it's missing.
cc @SamSaffron, really sorry for not catching this earlier.
Hum, I'm not too sure what is going on on windows :/
Ok, so it seems that on Windows the index is offsettted because of \r
:
[:info, " base64 \r\nmseq application/vnd.mseq "]
[:info, " base64 \r\nmsl application/vnd.Mobius.MSL "]
[:info, " base64 \r\nmts model/vnd.mts "]
[:info, " base64 \r\nmus application/vnd.musician "]
[:info, " base64 \r\nmusicxml application/vnd.recordare.m"]
I'll try to figure out a solution, it's just very painful to not be able to figure this out locally :/
Hum, there is one failure left on Windows that I can't make much sense of:
1) Failure:
MiniMimeTest#test_full_parity_with_mime_types [D:/a/mini_mime/mini_mime/test/mini_mime_test.rb:76]:
Expected: "application/x-cu-seeme"
Actual: "application/cu-seeme"
Nevermind, that test compare results with the mime-types
gem, so I suspect windows machines have a different mapping for some types.
No worries, can you add a special case in the test for windows then? I don't think there is a mega rush here, Ruby on Windows is really really painful
Nevermind, that test compare results with the
mime-types
gem, so I suspect windows machines have a different mapping for some types.
this is most likely because Ruby doesn't have a stable sort, see: https://github.com/mime-types/ruby-mime-types/issues/148 and https://bugs.ruby-lang.org/issues/1089
mime_x = 1
mime_y = 1
mime_x <> mime_y
in this case, if you compare 2 mime types with the same priority, the result will be mime_x
on Linux and usually mime_y
on Windows (yes, it's silly). Since mime_x has the same priority as mime_y, both results are actually correct.
I would say, it's a bug in mime-types's implementation and it's safe to ignore it...
sounds good, I guess we just add a special case into the spec?
Ok, so here's the list of differences on Windows:
Expected ".cu" to return "application/x-cu-seeme", got: "application/cu-seeme"
Expected ".ecma" to return "text/ecmascript", got: "application/ecmascript"
Expected ".es" to return "text/ecmascript", got: "application/ecmascript"
Expected ".jar" to return "application/x-java-archive", got: "application/java-archive"
Expected ".ser" to return "application/x-java-serialized-object", got: "application/java-serialized-object"
Expected ".mp4" to return "audio/mp4", got: "application/mp4"
Expected ".mpg4" to return "audio/mp4", got: "application/mp4"
Expected ".doc" to return "text/plain", got: "application/msword"
Expected ".pgp" to return "application/pgp-encrypted", got: "application/octet-stream"
Expected ".gpg" to return "application/pgp-encrypted", got: "application/octet-stream"
Expected ".ai" to return "application/postscript", got: "application/pdf"
Expected ".asc" to return "text/plain", got: "application/pgp-signature"
Expected ".rtf" to return "text/rtf", got: "application/rtf"
Expected ".spp" to return "application/vnd.sealed.ppt", got: "application/scvp-vp-response"
Expected ".sgml" to return "text/sgml", got: "application/sgml"
Expected ".curl" to return "text/vnd.curl", got: "application/vnd.curl"
Expected ".odc" to return "application/vnd.oasis.opendocument.chart-template", got: "application/vnd.oasis.opendocument.chart"
Expected ".odf" to return "application/vnd.oasis.opendocument.formula-template", got: "application/vnd.oasis.opendocument.formula"
Expected ".odi" to return "application/vnd.oasis.opendocument.image-template", got: "application/vnd.oasis.opendocument.image"
Expected ".bdm" to return "video/MP2T", got: "application/vnd.syncml.dm+wbxml"
Expected ".dcr" to return "image/x-kodak-dcr", got: "application/x-director"
Expected ".exe" to return "application/x-msdos-program", got: "application/x-ms-dos-executable"
Expected ".wmz" to return "application/x-msmetafile", got: "application/x-ms-wmz"
Expected ".cmd" to return "application/x-msdownload", got: "application/x-msdos-program"
Expected ".bat" to return "application/x-msdownload", got: "application/x-msdos-program"
Expected ".com" to return "application/x-msdownload", got: "application/x-msdos-program"
Expected ".reg" to return "application/x-msdownload", got: "application/x-msdos-program"
Expected ".ps1" to return "application/x-msdownload", got: "application/x-msdos-program"
Expected ".vbs" to return "application/x-msdownload", got: "application/x-msdos-program"
Expected ".pm" to return "application/x-perl", got: "application/x-pagemaker"
Expected ".xml" to return "text/xml", got: "application/xml"
Expected ".dtd" to return "text/xml", got: "application/xml-dtd"
Expected ".kar" to return "audio/x-midi", got: "audio/midi"
Expected ".mid" to return "audio/x-midi", got: "audio/midi"
Expected ".midi" to return "audio/x-midi", got: "audio/midi"
Expected ".m4a" to return "audio/MP4A-LATM", got: "audio/mp4"
Expected ".mp2" to return "video/mpeg", got: "audio/mpeg"
Expected ".ogg" to return "video/ogg", got: "audio/ogg"
Expected ".wav" to return "audio/x-wav", got: "audio/wav"
Expected ".webm" to return "video/webm", got: "audio/webm"
Expected ".wmv" to return "video/x-ms-wmv", got: "audio/x-ms-wmv"
Expected ".ra" to return "audio/x-realaudio", got: "audio/x-pn-realaudio"
Expected ".hif" to return "image/heic-sequence", got: "image/heic"
Expected ".sub" to return "text/vnd.dvb.subtitle", got: "image/vnd.dvb.subtitle"
Expected ".xbm" to return "image/x-xbm", got: "image/x-xbitmap"
Expected ".mts" to return "video/MP2T", got: "model/vnd.mts"
Expected ".rst" to return "text/prs.fallenstein.rst", got: "text/plain"
Ok, I added a list of windows differences.
looks good to me! Thanks @casperisfine
Followup: https://github.com/discourse/mini_mime/pull/50
Typically on Windows.