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

feat: use mimetype to determine filetype in linux #1073

Open
Rid1FZ opened this issue Jul 28, 2024 · 2 comments
Open

feat: use mimetype to determine filetype in linux #1073

Rid1FZ opened this issue Jul 28, 2024 · 2 comments

Comments

@Rid1FZ
Copy link

Rid1FZ commented Jul 28, 2024

As far as I noticed, eza uses some sort of regex or file extension to determine filetype. But it is very common in linux to fully avoid extension for any script for example. In that cases, eza shows default icon for that file (which is incorrect). Is it possible to use mimetype instead for filetype detectiom in linux? Mimetype of any file is detected by reading the file instead of using anything like regex. It helps to determine filetype more precisely.

@gierens
Copy link
Member

gierens commented Jul 28, 2024

You are correct, at the moment the filename/extension is used to determine the type. We are not using the mime/content type as far as I'm aware.

As for adding this functionality, sure that is possible, we would first have to check how to do it efficiently, though. If we really have to read the file, even just partly, this will likely incur a decent amount of overhead, so it would probably be best to put it behind a command line flag to enable it rather than making it the default behavior.

@cafkafk
Copy link
Member

cafkafk commented Jul 29, 2024

As for adding this functionality, sure that is possible, we would first have to check how to do it efficiently, though. If we really have to read the file, even just partly, this will likely incur a decent amount of overhead, so it would probably be best to put it behind a command line flag to enable it rather than making it the default behavior.

Ideally we would also start measuring that overhead, so we could make informed choices... but then again, we really need some way to catch performance regressions in reviews

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