-
Notifications
You must be signed in to change notification settings - Fork 9
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
XML File detected as plain/text #24
Comments
@zerlas Thank you for filing an issue but could you provide a better description, steps to reproduce, and sample data? |
i'm sorry, when i'm trying to get the type of a XML file like this : var path = Path.Combine(this.TestContext.DeploymentDirectory, "file.smmx"); // this file is a correct XML file
using (var file = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read))
using (var stream = new MemoryStream((int)file.Length))
{
file.CopyTo(stream);
var streamArray = stream.ToArray();
var type = streamArray.GetFileType();
type.ShouldNotBeNull();
type.Mime.ShouldEqual("application/xml"); // this line crash because type.Mime == "plain/text"
} This line : |
@zerlas Hmmm.... Given that XML files are plain text it may be matching on a Unicode byte order mark. Have you tried this file with the beta version of the library? |
i'm already on the last beta version : 0.0.6 beta4 |
Here are the first bytes of a problematic XML file on my side. Using nuget 0.0.6-beta4.
|
This has been fixed. The issue can be closed. |
Calling
GetFileType(this byte[] bytes)
returns "plain/text" instead of "application/xml".The text was updated successfully, but these errors were encountered: