From f697abe9a1351c2007c9c2bd9eb7a1b5d8b9b5d5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Magnus=20Gro=C3=9F?= Date: Fri, 26 Jun 2020 11:41:53 +0200 Subject: [PATCH] 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 --- Telegram/SourceFiles/data/data_document.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/data/data_document.cpp b/Telegram/SourceFiles/data/data_document.cpp index 8d198bd3a0..994b0e6fa0 100644 --- a/Telegram/SourceFiles/data/data_document.cpp +++ b/Telegram/SourceFiles/data/data_document.cpp @@ -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; }