From d2ae2c283df3d42e72a964d8891e0915f8f3a94b Mon Sep 17 00:00:00 2001 From: Albert Astals Cid Date: Fri, 13 Nov 2020 01:03:19 +0100 Subject: [PATCH] More fine tuning of the mime of the opened file In fba90677fcc9ccf0e6f5efe75e7446703d669d36 we introduced a "if we're told this is a text file let's check the mime of the content only since text files never fail to open". This extends it to anything that inherits from text now, so if you rename a PDF file to bla.php it still tries to open as a pdf first and if that files as a php file --- part/part.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/part/part.cpp b/part/part.cpp index 9570c6393..0f1da3ff4 100644 --- a/part/part.cpp +++ b/part/part.cpp @@ -1470,7 +1470,7 @@ bool Part::openFile() mimes << pathMime << argMime; } - if (mimes[0].name() == QLatin1String("text/plain")) { + if (mimes[0].inherits(QStringLiteral("text/plain"))) { QMimeType contentMime = db.mimeTypeForFile(fileNameToOpen, QMimeDatabase::MatchContent); mimes.prepend(contentMime); }