1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 02:36:34 +01:00

Merge pull request #778 from srazi/master

[Win] FileSchemeHandler: fixed issues with '*.lnk' and 'x:'
This commit is contained in:
David Rosca 2013-02-22 02:11:05 -08:00
commit d01c512520

View File

@ -44,12 +44,25 @@ QNetworkReply* FileSchemeHandler::createRequest(QNetworkAccessManager::Operation
} }
// Only list directories // Only list directories
QFileInfo fileInfo(request.url().toLocalFile()); QString filePath = request.url().toLocalFile();
QFileInfo fileInfo(filePath);
if (!fileInfo.isDir() || !fileInfo.isReadable() || !fileInfo.exists()) { if (!fileInfo.isDir() || !fileInfo.isReadable() || !fileInfo.exists()) {
return 0; return 0;
} }
#ifdef Q_OS_WIN
QNetworkRequest req = request;
if (filePath.endsWith(QLatin1Char(':'))) {
filePath.append(QLatin1Char('/'));
req.setUrl(QUrl::fromLocalFile(filePath));
}
else if (filePath.endsWith(QLatin1String(".lnk"))) {
req.setUrl(QUrl::fromLocalFile(fileInfo.canonicalFilePath()));
}
FileSchemeReply* reply = new FileSchemeReply(req);
#else
FileSchemeReply* reply = new FileSchemeReply(request); FileSchemeReply* reply = new FileSchemeReply(request);
#endif
return reply; return reply;
} }