Describe the bug
The library tag a file as "recognizable" where it should not. File is an empty array json file.
To Reproduce
Steps to reproduce the behavior:
https://dotnetfiddle.net/kZ4GNk
Minimal .NET Code to reproduce.
using System;
using FileTypeChecker;
public class Program
{
public static void Main()
{
byte[] data = [(byte)'[', (byte)']'];
Console.WriteLine(FileTypeValidator.IsTypeRecognizable(data));
// Throws MoreThanOneTypeMatchesException:
// More than one type (heic, M4v, mp4) matches the provided sequence
var type = FileTypeValidator.GetFileType(data);
}
}
Expected behavior
IsTypeRecognizable should return false
Context
The library is used to help filter incoming file on an API, and use
if (FileTypeValidator.IsTypeRecognizable(fileBytes)) {
IFileType fileType = FileTypeValidator.GetFileType(fileBytes);
//...
} else {
//...
}
Describe the bug
The library tag a file as "recognizable" where it should not. File is an empty array json file.
To Reproduce
Steps to reproduce the behavior:
https://dotnetfiddle.net/kZ4GNk
Minimal .NET Code to reproduce.
Expected behavior
IsTypeRecognizable should return false
Context
The library is used to help filter incoming file on an API, and use
if (FileTypeValidator.IsTypeRecognizable(fileBytes)) {
IFileType fileType = FileTypeValidator.GetFileType(fileBytes);
//...
} else {
//...
}