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

The msi file is marked to msword #231

Open
AFunnyAnt opened this issue Dec 29, 2021 · 4 comments
Open

The msi file is marked to msword #231

AFunnyAnt opened this issue Dec 29, 2021 · 4 comments

Comments

@AFunnyAnt
Copy link

AFunnyAnt commented Dec 29, 2021

Expected MIME type
application/x-ms-installer

Returned MIME type
application/msword

Expected Extension
.msi

Returned Extension
.doc

use version: github.com/gabriel-vasile/mimetype v1.4.0

has tried to do this: mimetype.SetLimit(1024 * 1024)

@gabriel-vasile
Copy link
Owner

If you don't have any privacy concerns, please upload the .msi file.

Does disabling the limit help?

 mimetype.SetLimit(0)
 mimetype.Detect(.msi)

@AFunnyAnt
Copy link
Author

mimetype.SetLimit(0)
mimeType, xerr := mimetype.DetectFile("./TortoiseGit-32bit.msi")
if xerr != nil {
fmt.Println("open failed", xerr)
}
fmt.Println("type:", mimeType.String())
fmt.Println("Extension:", mimeType.Extension())

type: application/msword
Extension: .doc

the msi link is: https://download.tortoisegit.org/tgit/2.12.0.0/TortoiseGit-2.12.0.0-32bit.msi

gabriel-vasile added a commit that referenced this issue Jan 29, 2022
Previously the offset for the CLSID was searched for using v3 offsets.
This commit changes detection to check CFB version in order to
choose between v3(512) and v4(4096) offsets.
https://www.loc.gov/preservation/digital/formats/fdd/fdd000392.shtml
@gabriel-vasile
Copy link
Owner

Hi, #240 should fix this.

You can test it with:

go get github.com/gabriel-vasile/mimetype@b497e3d7a11a41902e4e2f29d931521714befc26
mimetype.SetLimit(1024 * 1024)
mimetype.DetectFile("tortoise.msi")

Let me know if there's any problems still.

@AFunnyAnt
Copy link
Author

Thanks, in the above way, the problem is solved。
the result:
mime: application/x-ms-installer
Extension: .msi

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

2 participants