Comments (1)
Hi, thanks for opening your issue.
The problem is that the 'magic' tests are detecting your file as video/mp2t
. You can check this with the --debug --all
flags; the --debug
provides you with more info about where the result was obtained from and the --all
flag makes sure that all types of detection are used.
By default, mimetype
will try to use the mimeinfo database from freedesktop, that source correctly determines the file as being 'text'. You do not have the mimeinfo database installed, you can install it on Ubuntu using apt install desktop-file-utils
. It is pre-installed with most graphical desktops on Ubuntu.
The magic database, which incorrectly labels the file as video/mp2t
, is not part of this Perl module; it is used by the file
command. However the file
command uses different heuristics before it tries to use the magic database, it uses a stat first.
I hope this helps... even if a little.
$ mimetype --debug --all out.txt
> Data dirs are: /home/michiel/.local/share, /usr/share/gnome, /usr/local/share, /usr/share
> Checking inode type
> Checking globs for basename 'out.txt'
> Checking for extension '.txt'
out.txt: text/plain
> Checking all magic rules
> Value "G" at offset 5 matches at /usr/share/mime/magic line 1695
>> Value "G" at offset 197 matches at /usr/share/mime/magic line 1696
>>> Value "G" at offset 389 matches at /usr/share/mime/magic line 1697
>>>> Value "G" at offset 581 matches at /usr/share/mime/magic line 1698
>>>>> Value "G" at offset 773 matches at /usr/share/mime/magic line 1699
out.txt: video/mp2t
> File exists, trying default method
out.txt: text/plain
from file-mimeinfo.
Related Issues (20)
- need pod clarification HOT 1
- [PATCH] spelling fix HOT 1
- Test Failure on macOS Sierra HOT 4
- mimetype always reports text/plain when reading from stdin
- suggestion for behaviour of `mimetype_isa`
- Function _read_map_files not safe when triggered via extensions with $_ in scope
- WL: Merge in `mimetype_isa` from Role::MimeInfo? HOT 2
- Testsuite fails on Docker HOT 3
- Behaviour of `mimeopen -n` when no default exists.
- _default returns incorrect application when multiple mimeapps.list files are present HOT 1
- bash code is detected as audio/x-mod HOT 2
- Use of uninitialized value $file in open HOT 3
- File::MimeInfo::Magic::mimetype finds magic strings that aren't at the start of the file
- mimeopen with UTF-8 characters in parent directory name
- Warnings when no handler found HOT 1
- Mimeopen fails to open app with vim and neovim
- Please use individual XML files to get a good order for `extensions`
- "mimeopen --ask" hangs up the terminal where mimeopen is executed on HOT 3
- `mimeopen` uses wrong exit code even if execution went correctly HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from file-mimeinfo.