summaryrefslogtreecommitdiffstats
path: root/src/network
diff options
context:
space:
mode:
authorMartin Petersson <martin.petersson@nokia.com>2011-07-19 10:42:40 (GMT)
committerMartin Petersson <martin.petersson@nokia.com>2011-07-19 10:42:40 (GMT)
commit4082ed92ed80c57cb499de569631a664107ef05b (patch)
tree88151446e7e8d0a515733bdaf3c4a4d7312f6caa /src/network
parentefde1f9521962398c156efd0b6670a358537ba51 (diff)
downloadQt-4082ed92ed80c57cb499de569631a664107ef05b.zip
Qt-4082ed92ed80c57cb499de569631a664107ef05b.tar.gz
Qt-4082ed92ed80c57cb499de569631a664107ef05b.tar.bz2
QNetworkAccessFileBackend: Add warning for file url without scheme.
When the scheme is not set for a file we should accept the url but add a warning. The behaviour will change for Qt5 in which we should no longer accept the url if the scheme is not set. Task-number: QTBUG-17731 Reviewed-by: Markus Goetz
Diffstat (limited to 'src/network')
-rw-r--r--src/network/access/qnetworkaccessfilebackend.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/network/access/qnetworkaccessfilebackend.cpp b/src/network/access/qnetworkaccessfilebackend.cpp
index 42cc2c2..7c4adca 100644
--- a/src/network/access/qnetworkaccessfilebackend.cpp
+++ b/src/network/access/qnetworkaccessfilebackend.cpp
@@ -67,7 +67,7 @@ QNetworkAccessFileBackendFactory::create(QNetworkAccessManager::Operation op,
QUrl url = request.url();
if (url.scheme().compare(QLatin1String("qrc"), Qt::CaseInsensitive) == 0 || url.isLocalFile()) {
return new QNetworkAccessFileBackend;
- } else if (!url.scheme().isEmpty() && url.authority().isEmpty()) {
+ } else if (!url.isEmpty() && url.authority().isEmpty()) {
// check if QFile could, in theory, open this URL via the file engines
// it has to be in the format:
// prefix:path/to/file
@@ -75,7 +75,8 @@ QNetworkAccessFileBackendFactory::create(QNetworkAccessManager::Operation op,
//
// this construct here must match the one below in open()
QFileInfo fi(url.toString(QUrl::RemoveAuthority | QUrl::RemoveFragment | QUrl::RemoveQuery));
- if ((url.scheme().length()==1) && fi.exists())
+ // On Windows and Symbian the drive letter is detected as the scheme.
+ if (fi.exists() && (url.scheme().isEmpty() || (url.scheme().length() == 1)))
qWarning("QNetworkAccessFileBackendFactory: URL has no schema set, use file:// for files");
if (fi.exists() || (op == QNetworkAccessManager::PutOperation && fi.dir().exists()))
return new QNetworkAccessFileBackend;