Ok, so apparently some genious decided it would be a good idea for GNOME to automatically detect the type of file you are trying to open and refuse to open it if the mime type you chose for it doesn't match what it detects. For instance, say I was to associate .dat files with with the MIME type application/data. According to the official GNOME docs
, you should create a file in /usr/share/mime/packages called Overrides.xml, and place the following in it:
<?xml version='1.0' encoding='utf-8'?>
<mime-type type="application/data"><comment>raw data</comment><glob pattern="*.dat"/></mime-type>
Then you update the mime database by running "update-mime-database /usr/share/mime", and that should be all there is to it.
But, it's not nearly so simple (and it was already unneccesarily complicated since GNOME doesn't have any built in tools to manage MIME types). In addition to the manually configured MIME type, GNOME still performs a manual check of the contents of files to see if the match known MIME types, and if they don't it will refuse to open the file with an error similar to the following:
The filename "blah.dat" indicates that this file is of type "raw data". The contents of the file indicate that the file is of type "plain text document". If you open this file, the file might present a security risk to your system.
Do not open the file unless you created the file yourself, or received the file from a trusted source. To open the file, rename the file to the correct extension for "plain text document", then open the file normally. Alternatively, use the Open With menu to choose a specific application for the file.
Obviously having a mistaken identity of a dat file is going to be common, as it's a non-specific file type with varied usage. In this case, the file was mistaken for a plain text file, so GNOME refuses to open it. Well first of all, the file in question wasn't a plain text file to begin with, although it did contain plain text elements. Basically GNOME just plain got this file's identity wrong. In fact, opening it in a text editor and saving it would probably result in a corrupted file.
Now the question is, how do I get rid of this undesirable behavior and make GNOME open .dat files without a warning telling me it refuses to open the file because it detected the file was a different type than it's extension said it was even though it actually wasn't?