TransWikia.com

css files are reported as text/plain by mimetype on ubuntu machine

Server Fault Asked on November 14, 2021

When I run the following command
mimetype -DM --database /usr/share/misc/magic /path/to/reset.css
I expect to see text/css as a result but instead I get text/plain. Is there a way to fix this?

EDIT
Removing -M didn’t change anything

root@srv /var/www/vhosts/zf2skeleton # mimetype -D --database /usr/share/misc/magic module/Application/public/css/bootstrap.min.css 
> Data dirs are: /usr/share/misc/magic
> Checking inode type
WARNING: You don't seem to have a mime-info database. The
shared-mime-info package is available from http://freedesktop.org/ .
> Checking globs for basename 'bootstrap.min.css'
> Checking for extension '.min.css'
> Checking for extension '.css'
> File exists, trying default method
module/Application/public/css/bootstrap.min.css: text/plain

One Answer

The manpage you linked to says it looks in the following locations for the database:

$HOME/.local/share/mime
/usr/local/share/mime
/usr/share/mime

You can maybe figure out how to add an entry for CSS by looking at those directories.

After updating you have to run update-mime-database

EDIT:

You're using the -M switch which means it won't look at the file extension. It will look at the contents of the file only. A CSS file doesn't have a consistent header though so I doubt that will work.

Answered by sjbotha on November 14, 2021

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP