Bug 106312 - Detect PDF files by content, not filename extension
Summary: Detect PDF files by content, not filename extension
Status: CONFIRMED
Alias: None
Product: kdelibs
Classification: Frameworks and Libraries
Component: general (show other bugs)
Version: unspecified
Platform: openSUSE Linux
: NOR wishlist
Target Milestone: ---
Assignee: kdelibs bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2005-05-25 23:58 UTC by Christian Boltz
Modified: 2008-11-17 16:05 UTC (History)
2 users (show)

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Christian Boltz 2005-05-25 23:58:59 UTC
Version:            (using KDE KDE 3.4.0)
Installed from:    SuSE RPMs
OS:                Linux

KGhostView doesn't display PDF files named *.php. The first time I noticed this bug was when I tried to open http://www.openusability.org/reports/get_file.php?group_id=55&repid=43 in Konqueror (click "open with..." and select "kghostview").

Reproducing the bug is quite simple:
kghostview any.pdf # works
mv any.pdf any.php
kghostview any.php # does NOT work

Error message in German:
Fehler beim Öffnen der Datei .../any.php des Typs application/x-php. KGhostview kann nur PostScript-Dateien (.ps, .eps) und Dateien im Portable Document Format (.pdf) laden.

Translated:
Error opening file .../any.php of type application/x-php. KGhostView can only load PostScript files (.ps .eps) and files in Portable Document Format (PDF).

The problem exists at least with *.zip, *.tar, *.pl and *.sh filename also.

Opening files with *.foo, *.doc, *.tar.gz or *.cab extensions works.
-> it seems extensions not "known" to KDE do not cause problems.

Maybe it's a good idea to check the content of a file before blocking it as not displayable? ;-)
Comment 1 Dik Takken 2005-05-26 15:33:17 UTC
This is not the fault of KGhostview. It seems that PDF files are detected by their filename, not by their content.

Re-assigning to kfile-plugins, if that is where this belongs...
Comment 2 Dik Takken 2005-05-26 15:36:09 UTC
As for downloading the PDF file from openusabilily.org: The site does not report the correct mimetype, so it is mis-detected.
Comment 3 Pino Toscano 2008-05-22 22:32:12 UTC
This problem really belongs to kdelibs, not to the kfile-plugins.

And probably this is fixed with the new mimetype implementation based on the shared-mime-info database. David?
Comment 4 FiNeX 2008-11-17 16:05:36 UTC
I think pino is right.