Skip to content

Csv files are detected as SVG if any columns contains the string "<svg" in it #673

@ctunon-align

Description

@ctunon-align

Attach the file for which the detection is inaccurate

package main

import (
	"fmt"
	"github.com/gabriel-vasile/mimetype"
)

func main() {
	mtype := mimetype.Detect([]byte("col1,col2\n<svg,val"))
	fmt.Println(mtype.String(), mtype.Extension())
}

// outputs svg

Expected MIME type
text/csv .csv

Returned MIME type
image/svg+xml .svg

Version of the library you are using
go version go1.24.2 darwin/arm64

Output of go version
v1.4.9

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