Alle giovedì 19 aprile 2012, Stanley Schade ha scritto: > However, using the command "mimetype" returned the > correct mimetype and so did the properties dialog which can be > accessed by right-clicking on the file in dolphin: > > $ mimetype file.pdf.gz > file.pdf.gz: application/x-gzpdf > (Of course I checked that before reinstalling shared-mime-info.) Usually extensions have a slightly higher priority when matching freedesktop.org mimetypes, so foo.pdf.gz is usually considered application/x-gzpdf (i.e. a PDF document compressed with gzip). It seems that `mimetype` is part of a perl module for fdo mimetypes (never heard of it before); if you want to check closer how kde applications see file types, you can use `kmimetypefinder`. In case of this "compressed XXX document"-like mimetypes, you can easily check what is the mimetype (only by checking the file content though, so it could not always give a "good" result) of the compresse document doing $ gunzip -c foo.pdf.gz | kmimetypefinder -c - > Thus, I still consider this to be strange behaviour of okular. There's nothing strange: basically what okular does when asked to open a file is the following: 1. determine its mimetype 2. is it a compressed file (gzip, bzip2, or xz)? if so: 2a. uncompress it 2b. consider the uncompresed file the "new" file to open 2c. determine its mimetype 3. pick the first generator that handles said mimetype 4. does 3. succeed? if so, it ends here 5. determines again the mimetype of the file, but now only considering its content (and no more the file name eventually used in previous steps) 6. is this new mimetype different than the previously used one? if so: 6a. pick the first generator that handles said mimetype 6b. does 6a. succeed? if so, it ends here 7. all the attempts failed, so complain that the file couldn't be open As you can see (hope it is clear and I didn't make it confused :) ), okular does not mind the "pdf" part in the application/x-gzpdf mimetype determined initially for your document; what "gives you the feeling" it's a document is, as said above, because the mimetype detection (as used normally in dolphin, the file dialog, etc) thinks foo.pdf.gz is a gzipped PDF (even if it's, say, a XML file renamed to .pdf and compressed with gzip). Unfortunately there isn't nothing much that can be done in such cases, as the only viable alternative should be uncompressing compressed files, which you can guess it would be too expensive for what should be a "fast" operation. -- Pino Toscano
Attachment:
signature.asc
Description: This is a digitally signed message part.