jstedfast / MimeKit

A .NET MIME creation and parser library with support for S/MIME, PGP, DKIM, TNEF and Unix mbox spools.
http://www.mimekit.net
MIT License
1.84k stars 373 forks source link

GetMimeType(byte[] data) returns "audio/x-wav" for a .webp file instead of "image/webp" #1075

Closed kiwidyne closed 2 months ago

kiwidyne commented 2 months ago

Describe the bug A clear and concise description of what the bug is. When getting the contents of a .webp file from Google's webp gallery (specifically https://www.gstatic.com/webp/gallery/1.webp - although many other webp files caused the same behavior), putting the contents into a byte array (byte[]), and then calling .GetMimeType(byte[] data), the Mime type returned is "audio/x-wav" instead of "image/webp".

Windows 11 Pro (x64) CoreCLR .Net 8 MimeKit Version: 4.7.1

jstedfast commented 2 months ago

MimeKit doesn't have a GetMimeType(byte[] data) method. You are probably using some other MimeType library perhaps?

kiwidyne commented 2 months ago

Ugh. This is what I get for being tired. My apologies.

kiwidyne commented 2 months ago

OK, not as tired as I thought. I am not the original author of the code utilizing this. It is leveraging MimeKit, but it is also utilizing Winista.MimeDetect, which also has a class named MimeTypes, which contains the function I referenced in the bug report, hence my confusion. Again, sorry for the mixup.