QMimeDatabase::mimeTypeForUrl: skip content check for remote URLs

The code was trying to open a local file with the same path
as the remote URL, which is unnecessary and wrong in the unlikely
case where such a file would exist.

Spotted by Christoph Feck when reading the code.

Change-Id: I1d77e5781cf606b025d2877f48a9914dd1e36b1d
Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
This commit is contained in:
David Faure 2017-02-25 11:56:12 +01:00
parent f2df5c64bd
commit df06926b8a

View File

@ -526,7 +526,7 @@ QMimeType QMimeDatabase::mimeTypeForUrl(const QUrl &url) const
if (scheme.startsWith(QLatin1String("http")) || scheme == QLatin1String("mailto"))
return mimeTypeForName(d->defaultMimeType());
return mimeTypeForFile(url.path());
return mimeTypeForFile(url.path(), MatchExtension);
}
/*!