Skip to content
This repository has been archived by the owner on Jul 19, 2019. It is now read-only.

get_content_type dont find the correct answer #1

Open
VincentGuyader opened this issue Mar 22, 2018 · 3 comments
Open

get_content_type dont find the correct answer #1

VincentGuyader opened this issue Mar 22, 2018 · 3 comments

Comments

@VincentGuyader
Copy link

HI,

I have an .xlsx file, I copy and rename this file to have file.xlsx,file.csv,file.txt (I just change the extension)
This is what I obtain :

simplemagic::get_content_type("file.xlsx")
## [1] "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
simplemagic::get_content_type("file.xls")
## [1] "application/zip"
simplemagic::get_content_type("file.csv")
## [1] "application/zip"
simplemagic::get_content_type("file.txt")
## [1] "text/plain"

It will be perfect if all output could be "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"

Regards

@hrbrmstr
Copy link
Owner

Thx for filing the issue! There are extra checks I can add into the zip binary header area for this. Shld be a quick add.

@VincentGuyader
Copy link
Author

thks for your work on this.
If you need more test on this package , just ask !
If we could have a package on windows with zero dependencies and no compiled code it would be amaiing :)

@hrbrmstr
Copy link
Owner

don't hesitate to ask for more binary checks. while I'm not re-creating the libmagic library or file utility, adding in hardcoded checks riffed off of the magic file specs is pretty straightforward.

I just pushed an update that better handles excel, word and ppt with improper extensions and worked for a small series of local tests. kick the tyres when you get a chance and let me know if I need to tweak anything.

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

No branches or pull requests

2 participants