1
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-03-18 17:40:59 +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 
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();
});
const auto path = location.name();
if (QImageReader(path).canRead()) {
if (Core::MimeTypeForFile(path).name().startsWith("image/") && QImageReader(path).canRead()) {
Core::App().showDocument(data, context);
return;
}