1
mirror of https://invent.kde.org/network/falkon.git synced 2024-12-20 10:46:35 +01:00

[Win] FileSchemeHandler: fixed issues with '*.lnk' and 'x:'

This commit is contained in:
S. Razi Alavizadeh 2013-02-22 12:40:10 +03:30
parent 76849082e4
commit 33b9b3832f

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;
} }