Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.xsl file type is being detected as application/msword #230

Closed
InfoLibre opened this issue Dec 28, 2021 · 3 comments
Closed

.xsl file type is being detected as application/msword #230

InfoLibre opened this issue Dec 28, 2021 · 3 comments

Comments

@InfoLibre
Copy link

Attach the file for which the detection is inaccurate
You can use the file sharing site of your choice, just ensure the file will not expire or get deleted.

Bibliothèque de macros pour extraire des données de Baan.xls.zip

(unzip it to test)

Expected MIME type

application/vnd.ms-excel ?

Returned MIME type

application/msword

Version of the library you are using

1.4.0

Output of go version

go version go1.13.8 linux/amd64

Additional context

I'm using this code:

add_media.go.zip

@gabriel-vasile
Copy link
Owner

mimetype looks only at the first few bytes and sometimes the .xls signature is at the end of the file.
Try increasing readLimit:

// increase to 1MB, default is 3KB.
mimetype.SetLimit(1024 * 1024)
mimetype.DetectFile("file.xls")

@MrSwed
Copy link

MrSwed commented Oct 20, 2022

mimetype.SetLimit(2048 * 2048)

xls.xls

not helped :(

here https://www.htmlstrip.com/mime-file-type-checker it detect correctly

@gabriel-vasile
Copy link
Owner

I can confirm the issue is fixed for the attached file when increasing ReadLimit:

mimetype.SetLimit(1024 * 1024)

so let me close this issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants