Version: kdelibs-3.5.2 (-r4) (using KDE KDE 3.5.2) Installed from: Gentoo Packages Compiler: gcc version 3.4.6 (Gentoo 3.4.6-r1, ssp-3.4.5-1.0, pie-8.7.9) OS: Linux At first I try open pdf document form web, I use kdpf. Document name is document.php, but it is pdf file if I try open it with kpdf, but it shows: kpdf: WARNING: Unknown mimetype 'application/x-php'. (www server return valid [application/pdf]) If I try determine vhere problem is i got: kfile document.php document.php: PHP skript (application/x-php) document.php: Cannot determine metadata kfile document.php.pdf document.php.pdf: PDF dokument (application/pdf) I try file tooo: file document.php.pdf document.php.pdf: PDF document, version 1.4 after rename to document.pdf it work :)
We need an example to reproduce this. Are you opening a local file or something on a server? If it's a server, can you give us the URL?
It is simple, but I have the ability to make it complicated. Rename file on disk from something.pdf to something.php a try it open with kpdf. The same do browser(Mozilla), download file from web, store it in /tmp and call kpdf to open them. Www server return valid document type (in http head) and therefore mozilla call kpdf to open them, but kpdf does not do this. http://www.vscht.cz/document.php?docId=1283
Ok, I see. Albert: any ideas?
For local files i'd say it's a kdelibs problem, we ask the mimetype of the file and if it's not pdf we do not open it, for webfiles it should work, at least it works here both doing konqueror http://www.vscht.cz/document.php?docId=1283 that gives me kpdf embedded in konqueror, and kpdf http://www.vscht.cz/document.php?docId=1283 that gives me kpdf standalone
That means that the MIME type detection for PHP is being done on extensions, not on contents. Does KPDF require kdelibs to tell it the MIME type? Can't it try to open as PDF anyways and complain if the file isn't the correct format? I imagine that oKular would have problems down the line with this, though...
Not possible at the moment since kpdf already internally has some structure for plugins so we need to get the correct mimetype, maybe we are not doing it the right way but...
Closing the bug as not recognizing foo.php as a pdf file is a kdelibs "feature", open a bug against it if you want. Also both kpdf and konqueror are working here with http://www.vscht.cz/document.php?docId=1283 Please reopen the bug if you do not agree or kpdf/konqueror are failing when going to http://www.vscht.cz/document.php?docId=1283 Thanks for reporting.
*** Bug 138192 has been marked as a duplicate of this bug. ***
I can see that kfile is buggy/stupid: $ kfile index.pdf index.pdf: PDF-Dokument (application/pdf) $ cp index.pdf index.html $ kfile index.html index.html: HTML-Dokument (text/html) $ file index.html index.html: PDF document, version 1.3 In other words, |kfile| only looks at the file extension. |file| correctly determines the file type based on the content. If anything, |kfile| should be smarter than |file|. I'll file a bug against kfile. Independent of that, I do not agree with the resolution. If I specifically open a file with KPDF, then you should assume that it's a PDF file (kfile is irrelevant in this situation) and try to open it. Only when the PDF parser fails (based on the file content) should an error be shown. My reproduction: Web server (Handelsblatt "News am Abend" in this case) delivers file with URL .../6754548/index.html, mimetype "application/pdf". Firefox uses the "external helper app" code path, I specify KPDF as app to open the file with, Firefox downloads it and saves it as "/tmp/index.html" (based on the URL), and launches "kpdf /tmp/index.html". KPDF fails. Sure, Firefox could change the file extensions, but that may break other things. If I launch "kpdf foo.bar", just assume it's a PDF file. Why else would I launch KPDF with it? Please REOPEN. I don't have the access rights to do that.