Registered Member
|
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? |
Administrator
|
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?
KDE Sysadmin
[img]content/bcooksley_sig.png[/img] |
Registered Member
|
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? |
Global Moderator
|
What does kmimetypefinder <yourfile> say? That's probably more relevant, no?
Greetings
I'm working on the KDevelop IDE.
|
Administrator
|
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] |
Registered Member
|
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? |
Global Moderator
|
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.
|
Registered Member
|
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? |
Global Moderator
|
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.
|
Registered users: bancha, Bing [Bot], Evergrowing, Google [Bot], mesutakcan, Sogou [Bot]