From d5d07f26f683e4737b0ecc7da4a8cfce493aec2d Mon Sep 17 00:00:00 2001 From: David Faure Date: Mon, 8 Jul 2013 14:20:03 +0200 Subject: QUrl: let StripTrailingSlash remove multiple trailing slashes Change-Id: Ic4c8f70bb729630d9110ed6766dd9e40f9ab4d80 Reviewed-by: Thiago Macieira --- src/corelib/io/qurl.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'src') diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 00588da15f..f8a8bd18e3 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -817,8 +817,10 @@ inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions o thePath = path.left(slash+1); } // check if we need to remove trailing slashes - if ((options & QUrl::StripTrailingSlash) && !thePath.isEmpty() && thePath != QLatin1String("/") && thePath.endsWith(QLatin1Char('/'))) - thePath.chop(1); + if (options & QUrl::StripTrailingSlash) { + while (thePath.length() > 1 && thePath.endsWith(QLatin1Char('/'))) + thePath.chop(1); + } if (appendingTo != Path && !(options & QUrl::EncodeDelimiters)) { if (!qt_urlRecode(appendTo, thePath.constData(), thePath.constEnd(), options, decodedPathInUrlActions)) -- cgit v1.2.3