This forum has been archived. All content is frozen. Please use KDE Discuss instead.
Please use bugs.kde.org for bug reports or feature requests. Development related questions should be directed to the okular-devel mailing list.

PDF files with other suffix aren't read as PDF's

Tags: None
(comma "," separated)
dilbot
Registered Member
Posts
4
Karma
0
It seems that after I've upgraded Okular, it no longer can recognize PDF's unless they have a *.pdf suffix. I use an application which writes PDFs with a different suffix and these used to open fine.

Any work-around for this?
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
This is rather unusual, as Okular much like all other KDE applications uses mimetypes - which determine the type of file based on both certain markers in files, and their extension.

Can you please provide the output of the following command, run against one of the files in question?
Code: Select all
file --mime-type <filename>


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
dilbot
Registered Member
Posts
4
Karma
0
Here's the output of "file --mime-type <filename>":

PrintCustTransPortrait.php: application/pdf

I can send in a file as well - where should it be posted?
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS
What does kmimetypefinder <yourfile> say? That's probably more relevant, no?

Greetings


I'm working on the KDevelop IDE.
User avatar
bcooksley
Administrator
Posts
19765
Karma
87
OS
Indeed, yes - it probably is more relevant. If it also returns application/pdf - are you seeing this behaviour in Dolphin, or from Okular's open file dialog?


KDE Sysadmin
[img]content/bcooksley_sig.png[/img]
dilbot
Registered Member
Posts
4
Karma
0
Here's the kmimetypefinder:

kmimetypefinder PrintCustTransPortrait.php
application/x-php
(accuracy 100)

The application that generates these files hasn't changed on our server - this problem started when I updated okular last weekend. If I rename to PrintCustTransPortrait.pdf, it's readable by okular.

So it seems that Okular no longer looks at the file itself, but only the suffix? And the pdf files that are named *.php (from the scripts that generated them) are being taken as php files?
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS
Honestly, fix your script to give files proper extensions. PDF files should not have a .php suffix and rely on programs figuring out what they really are. ;)

That being said, it's probably not okular itself but a change in a more generic component, probably the mimetype finder. It might be an optimization to make it faster. I even remember something like that being discussed a while ago on reviewboard.

Greetings,
Sven


I'm working on the KDevelop IDE.
dilbot
Registered Member
Posts
4
Karma
0
Sven said "Honestly, fix your script to give files proper extensions. PDF files should not have a .php suffix and rely on programs figuring out what they really are. "


You are right. I completely agree. But I didn't write the original application (webERP), and it does what it does. The thing is, the previous version of okular recognized the files fine. So I think this is a new problem with the latest version of okular.

And I would say that an app is better off looking at what the file really is rather than relying entirely on the suffix anyways. If a file is suffixed <filename.borked> or <filename.lindsaylohan> but still comes up as a pdf in the "file" command, shouldn't it be readable?
User avatar
scummos
Global Moderator
Posts
1175
Karma
7
OS
You're right in that the speed argument doesn't really hold if it's just about one file. So while only using the extension might make sense for dolphin, in this case the more expensive method would probably be preferrable. You can file a bug about that at bugs.kde.org if you like.

Greetings,
Sven


I'm working on the KDevelop IDE.


Bookmarks



Who is online

Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], mesutakcan, Sogou [Bot]