[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kdelibs-bugs
Subject:    [kio] [Bug 220496] Preview of pictures when content type does not match extension
From:       miklos <bugzilla_noreply () kde ! org>
Date:       2018-03-31 13:30:45
Message-ID: bug-220496-90985-IgKmAEpQPf () http ! bugs ! kde ! org/
[Download RAW message or body]

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

--- Comment #13 from miklos <mtmkls@gmail.com> ---
Now I found this again, and I had some time to debug it.

The file metadata is gathered by FileMetaDataWidget of baloo-widgets, which
launches an external program (baloo_filemetadata_temp_extractor) to parse the
file and return its properties, so the file description in the tooltip and the
information panel is always correct.

The preview is generated with KIO::PreviewJob(), which gets the mime type of
the file from its name: kio/src/widgets/previewjob.cpp:304 calls
kio/src/core/kfileitem.cpp:732, where QMimeDatabase is asked for the mime type
based on the file name. This is wrong when the file suffix is wrong, and
apparently there is a different preview generator for jpeg and png.

I see three possible solutions:
- QMimeDatabase supports parsing the file to find out its type
- do not filter for mime type in PreviewJob, try all preview generators and
accept the first success (the preview generators need to be ordered carefully
to minimize the chance of false positive)
- use the file properties gathered by baloo-widgets when requesting the preview
(this needs new API in KIO::PreviewJob, and I'm not sure if KIO is allowed to
depend on Baloo)

I'm leaning toward option 2. It works fine in Okular for example.

-- 
You are receiving this mail because:
You are on the CC list for the bug.=
[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic