filetype icon indicating copy to clipboard operation
filetype copied to clipboard

ASCII Text Files Starting With Letters "BM" Are Treated As BMP Image Files

Open AndrewSverdrup opened this issue 2 years ago • 0 comments

Bug: ASCII Text Files Starting With Letters "BM" Are Treated As BMP Image Files

Example code:

go get github.com/h2non/filetype
package main

import (
    "fmt"
    "github.com/h2non/filetype"
)

func main() {
    file_contents := []byte("BMW")

    kind, _ := filetype.Match(file_contents)
    fmt.Println(kind)
}
go build -o project *.go
./project

Output:

{{image bmp image/bmp} bmp}

AndrewSverdrup avatar Aug 15 '22 22:08 AndrewSverdrup