diff options
Diffstat (limited to 'src/corelib/io')
-rw-r--r-- | src/corelib/io/qurl.cpp | 15 | ||||
-rw-r--r-- | src/corelib/io/qurl.h | 20 |
2 files changed, 19 insertions, 16 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 9607f14853..9f9653ea94 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -1089,8 +1089,11 @@ inline void QUrlPrivate::setQuery(const QString &value, int from, int iend) inline void QUrlPrivate::appendHost(QString &appendTo, QUrl::FormattingOptions options) const { - // this is the only flag that matters - options &= QUrl::EncodeUnicode; + // EncodeUnicode is the only flag that matters + if ((options & QUrl::FullyDecoded) == QUrl::FullyDecoded) + options = 0; + else + options &= QUrl::EncodeUnicode; if (host.isEmpty()) return; if (host.at(0).unicode() == '[') { @@ -3249,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; } @@ -3964,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; } diff --git a/src/corelib/io/qurl.h b/src/corelib/io/qurl.h index 457440bb89..abb7df0056 100644 --- a/src/corelib/io/qurl.h +++ b/src/corelib/io/qurl.h @@ -209,22 +209,22 @@ public: void setUserInfo(const QString &userInfo, ParsingMode mode = TolerantMode); QString userInfo(ComponentFormattingOptions options = PrettyDecoded) const; - void setUserName(const QString &userName, ParsingMode mode = TolerantMode); - QString userName(ComponentFormattingOptions options = PrettyDecoded) const; + void setUserName(const QString &userName, ParsingMode mode = DecodedMode); + QString userName(ComponentFormattingOptions options = FullyDecoded) const; - void setPassword(const QString &password, ParsingMode mode = TolerantMode); - QString password(ComponentFormattingOptions = PrettyDecoded) const; + void setPassword(const QString &password, ParsingMode mode = DecodedMode); + QString password(ComponentFormattingOptions = FullyDecoded) const; - void setHost(const QString &host, ParsingMode mode = TolerantMode); - QString host(ComponentFormattingOptions = PrettyDecoded) const; - QString topLevelDomain(ComponentFormattingOptions options = PrettyDecoded) const; + void setHost(const QString &host, ParsingMode mode = DecodedMode); + QString host(ComponentFormattingOptions = FullyDecoded) const; + QString topLevelDomain(ComponentFormattingOptions options = FullyDecoded) const; void setPort(int port); int port(int defaultPort = -1) const; - void setPath(const QString &path, ParsingMode mode = TolerantMode); - QString path(ComponentFormattingOptions options = PrettyDecoded) const; - QString fileName(ComponentFormattingOptions options = PrettyDecoded) const; + void setPath(const QString &path, ParsingMode mode = DecodedMode); + QString path(ComponentFormattingOptions options = FullyDecoded) const; + QString fileName(ComponentFormattingOptions options = FullyDecoded) const; bool hasQuery() const; void setQuery(const QString &query, ParsingMode mode = TolerantMode); |