Skip to content

Prefer mime type from content over file name when loading

Arjen Hiemstra requested to merge work/ahiemstra/mimetype into master

QMimeDatabase::mimeTypeForFileNameAndData() will prefer using the filename for mime type determination. This allow it to be fooled when the filename is something different than the contents. To avoid this, reverse the logic and first try to determine the mimetype from the file's contents and only use filename if that fails.

BUG: 329140

Additionally, use the determined mimetype as format hint, rather than the file name.

Also fix a race condition that would occur when trying to view an image that is not shown in the thumbnail view, which would reset the image we are viewing to the first entry in the directory.

Edited by Arjen Hiemstra

Merge request reports

Loading