diff options
author | Martin Petersson <martin.petersson@nokia.com> | 2011-07-19 10:42:40 (GMT) |
---|---|---|
committer | Martin Petersson <martin.petersson@nokia.com> | 2011-07-19 10:42:40 (GMT) |
commit | 4082ed92ed80c57cb499de569631a664107ef05b (patch) | |
tree | 88151446e7e8d0a515733bdaf3c4a4d7312f6caa /src/network | |
parent | efde1f9521962398c156efd0b6670a358537ba51 (diff) | |
download | Qt-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.cpp | 5 |
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; |