Commit 9e23338b authored by Albert Astals Cid's avatar Albert Astals Cid

Fix opening markdown files

In d2ae2c28 we introduced a tweak that
broke opening markdown files.

what we really want is this:
 * If the mimetype from the filename is text (or children) but looking
   at the data says it's not text, then try opening first opening with
   the data suggeted mimetype
 * But if the data suggested mimetype says it's text, use the filename
   suggested mimetype since for example, the only way to really
   differentiate markdown from text is the filename, so trust that

BUGS: 430538
parent d1126826
Pipeline #45418 passed with stage
in 33 minutes and 38 seconds
......@@ -1473,8 +1473,10 @@ bool Part::openFile()
}
if (mimes[0].inherits(QStringLiteral("text/plain"))) {
QMimeType contentMime = db.mimeTypeForFile(fileNameToOpen, QMimeDatabase::MatchContent);
mimes.prepend(contentMime);
const QMimeType contentMime = db.mimeTypeForFile(fileNameToOpen, QMimeDatabase::MatchContent);
if (contentMime.name() != QLatin1String("text/plain")) {
mimes.prepend(contentMime);
}
}
} else {
mimes << pathMime;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment