use classify function for mimetype detection

The globFilename function only searches for the globs in the mimetypesregistry but there are mimetypes that only have configured extensions so this doesn't work properly. Since this effect works either way to work with extensions is also not robust. 
This now uses both and also would fall back on magicbytes if we don't find a mimetype either way.