Skip to content

deb file incorrectly matching to ar #126

@pdinfinera

Description

@pdinfinera

I have a deb file and after running the following code I get kind.Extension is ar instead of deb

buf, _ := ioutil.ReadFile("foo.deb")
kind, _ filetype.Match(buf)
fmt.Print(kind.Extension)
fmt.Print(kind.MIME.Value)

Output

ar
application/x-unix-archive

On other tries, I see the following output

deb
application/vnd.debian.binary-package

I'm guessing that it's due to arMagic and debMagic sharing the same first 7 bytes and that the ar matcher is sometimes running before deb matcher. Since arMagic and debMagic are added to a map, there's no guarantee as to the order when they get registered.

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