summaryrefslogtreecommitdiffstats
path: root/src/corelib/io
diff options
context:
space:
mode:
authorDavid Faure <faure@kde.org>2012-05-22 17:43:50 +0200
committerQt by Nokia <qt-info@nokia.com>2012-05-23 14:18:34 +0200
commitf06b629bfb42f50b9562704b3be49f5d3f8510bb (patch)
tree8d79e47fd2b87187ca7e6e90635034399292d349 /src/corelib/io
parent06906ce40d40bb95d82aa3ad78dd99e31581cb03 (diff)
Fix handling of invalid urls in QDataStream << QUrl
When given an invalid url, the output shouldn't be a valid url. KDE's kurltest detected this regression compared to Qt4, where all invalid urls were empty in toString() -- but we don't want that, to give as much feedback as possible to the user. Change-Id: Ie53e6e1c0a1d4bb9e12b820220dfb7e2f7753959 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io')
-rw-r--r--src/corelib/io/qurl.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 6e17740869..1bad2a95e9 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -2879,7 +2879,9 @@ bool QUrl::isParentOf(const QUrl &childUrl) const
*/
QDataStream &operator<<(QDataStream &out, const QUrl &url)
{
- QByteArray u = url.toString(QUrl::FullyEncoded).toLatin1();
+ QByteArray u;
+ if (url.isValid())
+ u = url.toEncoded();
out << u;
return out;
}