Skip to content

Tags '[]' as recognizable and throws with "MoreThanOneTypeMatchesException" (heic, M4v, mp4) #61

Description

@Wither87-fr

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 {
//...
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions