2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-03 16:15:13 +00:00

Do not open non-images as image

QImageReader might report PDF as a viable image type, if Qt is
dynamically linked and QtWebEngine is installed.

Fixed by additionally checking the mime type.

Fixes #8102
This commit is contained in:
Magnus Groß
2020-06-26 11:41:53 +02:00
committed by John Preston
parent ae31bdcd1b
commit f697abe9a1

View File

@@ -322,7 +322,7 @@ void DocumentOpenClickHandler::Open(
location.accessDisable(); location.accessDisable();
}); });
const auto path = location.name(); const auto path = location.name();
if (QImageReader(path).canRead()) { if (Core::MimeTypeForFile(path).name().startsWith("image/") && QImageReader(path).canRead()) {
Core::App().showDocument(data, context); Core::App().showDocument(data, context);
return; return;
} }