This forum has been archived. All content is frozen. Please use KDE Discuss instead.

what's wrong with my KDF magic file?

Tags: None
(comma "," separated)
yueche
Registered Member
Posts
7
Karma
0
Hi KDE experts

I have installed a KDE with KPDF. In most cases, they worked very well. However, yesterday, I converted a ppt file (MS powerpoint file) to pdf, forgot to rename the file (suppose it is foo.ppt) and try to use kpdf to open it. KPDF returned error of Unknown mimetype 'application/mspowerpoint'. After I corrected the file extension, renaming the file to foo.pdf, KPDF was able to open it.

I remember on another host, KPDF is able to open PDF file even the file' extension is wrong.

I have checked the code, KPDF calles KMimetype::findbyPath to determine the file type. But it seem the magic mechanism does not work so that KDE had to fall back to use file extension to judge the file type.

I also checked my KDE environment referring to google with key work "KDE, mime, magic", it seems the $KDEDIR/share/mimelnk/magic is in correct format.

Could anyone tell me what's wrong with my system?

Last edited by yueche on Tue Nov 10, 2009 10:15 am, edited 1 time in total.
yueche
Registered Member
Posts
7
Karma
0
more detailed debug information shows kfile could not recognize the file, either.

Code: Select all
[vdeadmin@sh-jeep kde]$ env|grep KDE
KDEDIR=/opt/kde
KDEBASE=/opt/kde
[vdeadmin@sh-jeep kde]$ /opt/kde/bin/kfile ~/foo.ppt
/home/vdeadmin/abc.ppt: Microsoft PowerPoint Presentation (application/mspowerpoint)
/home/vdeadmin/abc.ppt: Cannot determine metadata
[vdeadmin@sh-jeep kde]$ ls -l share/mimelnk/magic
-rw-r--r--  1 root root 41988 Oct 23 22:21 share/mimelnk/magic


But I don't know how to fix this :((
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
It is probable that Windows based Powerpoint does not set the vital mime type information on the file, which Mac's also use I believe ( in addition to file extensions )

You can confirm this by using the "file" command.

Therefore KDE applications have to implicitly trust that anything *.ppt is a Powerpoint file.


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
yueche
Registered Member
Posts
7
Karma
0
Hi bcooksley

Thanks for the reply. I have figured out the root cause.

My current kpdf version is newer(0.5.10) than the one( which does accept pdf file with ppt extention in file name.

I guess it is a new feature introduced, because after I changed the API KMime::FindbyFilePath to KMime::FindbyFileContent. It can recognize the file mentioned before.


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], lockheed, Sogou [Bot], Yahoo [Bot]