Bug 106312

Summary: Detect PDF files by content, not filename extension
Product: [Unmaintained] kdelibs Reporter: Christian Boltz <kde-bugs>
Component: generalAssignee: kdelibs bugs <kdelibs-bugs>
Status: RESOLVED UNMAINTAINED    
Severity: wishlist CC: finex, pino
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: openSUSE   
OS: Linux   
Latest Commit: Version Fixed In:
Sentry Crash Report:

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.
Comment 5 Christoph Cullmann 2024-09-14 16:18:08 UTC
Hi,

kdelibs (version 4 and earlier) is no longer maintained since a few years.

KDE Frameworks 5 or 6 might already have implemented this wish.

If not, please re-open against the matching framework if feasible or against the application that shows the issue.

We then can still dispatch it to the right Bugzilla product or component.

Greetings
Christoph Cullmann