From 33b9b3832f12f0280cc10b5f3e6de4074212df22 Mon Sep 17 00:00:00 2001 From: "S. Razi Alavizadeh" Date: Fri, 22 Feb 2013 12:40:10 +0330 Subject: [PATCH] [Win] FileSchemeHandler: fixed issues with '*.lnk' and 'x:' --- .../network/schemehandlers/fileschemehandler.cpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/src/lib/network/schemehandlers/fileschemehandler.cpp b/src/lib/network/schemehandlers/fileschemehandler.cpp index 887ae2fa6..d2a9cd1be 100644 --- a/src/lib/network/schemehandlers/fileschemehandler.cpp +++ b/src/lib/network/schemehandlers/fileschemehandler.cpp @@ -44,12 +44,25 @@ QNetworkReply* FileSchemeHandler::createRequest(QNetworkAccessManager::Operation } // Only list directories - QFileInfo fileInfo(request.url().toLocalFile()); + QString filePath = request.url().toLocalFile(); + QFileInfo fileInfo(filePath); if (!fileInfo.isDir() || !fileInfo.isReadable() || !fileInfo.exists()) { 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); +#endif return reply; }