[okular] [Bug 378449] Fall back to PDF when file type cannot be inferred from extension or MIME type

Jonathan Verner bugzilla_noreply at kde.org
Sun Sep 30 23:13:21 BST 2018


https://bugs.kde.org/show_bug.cgi?id=378449

--- Comment #17 from Jonathan Verner <jonathan.verner at gmail.com> ---
(In reply to Albert Astals Cid from comment #16)

> Pointing to lines of code is bad, he pretends like he understands the code,
> which he doesn't, so it makes him less credible. 

I know some user comments may be frustrating, but IMHO a reply implying bad
faith ("pretends") and lack of skill ("he doesn't understand code") does more
damage than good and goes against the KDE code of conduct. I'd suggest you
ignore the bug if the user comments brush you the wrong way and you can't reply
in a positive way (which is HARD, I admit).

As far as the bug goes, I can now reproduce it. The problem seems to be that
okular only looks at the contents when the etension either is not registered in
the system mimetype database at all or it is registered to a mimetype which
Okular has a plugin for. If it is and the extension does not correspond to the
file contents, okular fails opening the file:

  $ okular test.pdf
  $ mv test.pdf test.ods
  $ okular test.ods
  $ mv test.ods test.non_registered_ext
  $ okular test.non_registered_ext
  $ mv test.non_registered_ext test.txt
  $ okular test.txt

Only the third line fails for me (because ods is registered as an extension of
mime type 'application/vnd.oasis.opendocument.spreadsheet' on my system and
okular has no plugin for it)

> provide a patch that fixes the issue for him, he should stop pointing to the
> code and start trying to help us reproduce the issue.

Actually, pointing to the code made it easier for me to go over it (I wouldn't
bother without the link). It seems there really is a bug there:

https://github.com/KDE/okular/blob/21836ba072b2d4189f1257af06c11f134f2edc31/core/document.cpp#L2417

should use the 'QMimeDatabase::MatchContent' mode instead of
'QMimeDatabase::MatchExtension'.

-- 
You are receiving this mail because:
You are the assignee for the bug.


More information about the Okular-devel mailing list