summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qurl.cpp
diff options
context:
space:
mode:
authorDavid Faure <david.faure@kdab.com>2013-07-25 12:52:27 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-21 23:50:44 +0200
commit1de1470189991f5334439048a4d875e97193a82d (patch)
tree92820928624215e52b6b1745de2b3669885b4d56 /src/corelib/io/qurl.cpp
parentf874a5dd8b42a346ee7d036c4de78a9da26f961d (diff)
QUrl: Use decoded mode by default for individual getters/setters.
This fixes the wrong value for path() and fileName() when a path or file name actually contains a '%'. userInfo() and authority() are not individual getters, they combine two or more fields, so full decoding isn't possible (e.g. username containing a ':'). [ChangeLog][Important Behavior Changes][QUrl and QUrlQuery]QUrl now defaults to decoded mode in the getters and setters for userName, password, host, topLevelDomain, path and fileName. This means a '%' in one of those fields is now returned (or set) as '%' rather than "%25". In the unlikely case where the former behavior was expected, pass PrettyDecoded to the getter and TolerantMode to the setter. Change-Id: Iaeecbde9c269882e79f08b29ff8c661157c41743 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib/io/qurl.cpp')
-rw-r--r--src/corelib/io/qurl.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index f33e446a98..9f9653ea94 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -3252,8 +3252,8 @@ QUrl QUrl::adjusted(QUrl::FormattingOptions options) const
that.setPath(QString());
} else if (options & (StripTrailingSlash | RemoveFilename | NormalizePathSegments)) {
QString path;
- d->appendPath(path, options, QUrlPrivate::Path);
- that.setPath(path);
+ d->appendPath(path, options | FullyEncoded, QUrlPrivate::Path);
+ that.setPath(path, TolerantMode);
}
return that;
}
@@ -3967,9 +3967,9 @@ uint qHash(const QUrl &url, uint seed) Q_DECL_NOTHROW
static QUrl adjustFtpPath(QUrl url)
{
if (url.scheme() == ftpScheme()) {
- QString path = url.path();
+ QString path = url.path(QUrl::PrettyDecoded);
if (path.startsWith(QLatin1String("//")))
- url.setPath(QLatin1String("/%2F") + path.midRef(2));
+ url.setPath(QLatin1String("/%2F") + path.midRef(2), QUrl::TolerantMode);
}
return url;
}