diff --git a/autotests/kdiroperatortest.cpp b/autotests/kdiroperatortest.cpp --- a/autotests/kdiroperatortest.cpp +++ b/autotests/kdiroperatortest.cpp @@ -105,6 +105,7 @@ QTest::newRow("with_host") << QUrl(QStringLiteral("ftp://foo.com/folder")) << QUrl(QStringLiteral("ftp://foo.com/folder/")); QTest::newRow("with_no_host") << QUrl(QStringLiteral("smb://")) << QUrl(QStringLiteral("smb://")); QTest::newRow("with_host_without_path") << QUrl(QStringLiteral("ftp://user@example.com")) << QUrl(QStringLiteral("ftp://user@example.com")); + QTest::newRow("with_trailing_slashs") << QUrl::fromLocalFile(QDir::tempPath() + QLatin1String("////////")) << QUrl::fromLocalFile(QDir::tempPath() + QLatin1Char('/')); } void testSetUrlPathAdjustment() diff --git a/autotests/kurifiltertest.cpp b/autotests/kurifiltertest.cpp --- a/autotests/kurifiltertest.cpp +++ b/autotests/kurifiltertest.cpp @@ -233,7 +233,7 @@ setupColumns(); // URI that should require no filtering addRow("http://www.kde.org", QStringLiteral("http://www.kde.org"), KUriFilterData::NetProtocol); - addRow("http://www.kde.org/developer//index.html", QStringLiteral("http://www.kde.org/developer//index.html"), KUriFilterData::NetProtocol); + addRow("http://www.kde.org/developer//index.html", QStringLiteral("http://www.kde.org/developer/index.html"), KUriFilterData::NetProtocol); addRow("file:///", QStringLiteral("/"), KUriFilterData::LocalDir); addRow("file:///etc", QStringLiteral("/etc"), KUriFilterData::LocalDir); addRow("file:///etc/passwd", QStringLiteral("/etc/passwd"), KUriFilterData::LocalFile); @@ -253,6 +253,9 @@ addRow("///", QStringLiteral("/"), KUriFilterData::LocalDir); addRow("////", QStringLiteral("/"), KUriFilterData::LocalDir); addRow("///tmp", QStringLiteral("/tmp"), KUriFilterData::LocalDir); + addRow("///tmp/", QStringLiteral("/tmp/"), KUriFilterData::LocalDir); + addRow("///tmp//", QStringLiteral("/tmp/"), KUriFilterData::LocalDir); + addRow("///tmp///", QStringLiteral("/tmp/"), KUriFilterData::LocalDir); if (QFile::exists(QDir::homePath() + QLatin1String("/.bashrc"))) { addRow("~/.bashrc", QDir::homePath() + QStringLiteral("/.bashrc"), KUriFilterData::LocalFile, QStringList(QStringLiteral("kshorturifilter"))); @@ -304,7 +307,9 @@ setupColumns(); // hostnames are lowercased by QUrl addRow("http://www.myDomain.commyPort/ViewObjectRes//Default:name=hello", - QStringLiteral("http://www.mydomain.commyport/ViewObjectRes//Default:name=hello"), KUriFilterData::NetProtocol); + QStringLiteral("http://www.mydomain.commyport/ViewObjectRes/Default:name=hello"), KUriFilterData::NetProtocol); + addRow("http://www.myDomain.commyPort/ViewObjectRes/Default:name=hello?a=a///////", + QStringLiteral("http://www.mydomain.commyport/ViewObjectRes/Default:name=hello?a=a///////"), KUriFilterData::NetProtocol); addRow("ftp://ftp.kde.org", QStringLiteral("ftp://ftp.kde.org"), KUriFilterData::NetProtocol); addRow("ftp://username@ftp.kde.org:500", QStringLiteral("ftp://username@ftp.kde.org:500"), KUriFilterData::NetProtocol); diff --git a/src/filewidgets/kdiroperator.cpp b/src/filewidgets/kdiroperator.cpp --- a/src/filewidgets/kdiroperator.cpp +++ b/src/filewidgets/kdiroperator.cpp @@ -1004,7 +1004,7 @@ if (!_newurl.isValid()) { newurl = QUrl::fromLocalFile(QDir::homePath()); } else { - newurl = _newurl; + newurl = _newurl.adjusted(QUrl::NormalizePathSegments); } if (!newurl.path().isEmpty() && !newurl.path().endsWith(QLatin1Char('/'))) { @@ -1235,7 +1235,8 @@ void KDirOperator::cdUp() { - QUrl tmp(d->currUrl); + // Allow /d/c// to go up to /d/ instead of /d/c/ + QUrl tmp(d->currUrl.adjusted(QUrl::NormalizePathSegments)); setUrl(tmp.resolved(QUrl(QStringLiteral(".."))), true); } diff --git a/src/widgets/kurifilter.cpp b/src/widgets/kurifilter.cpp --- a/src/widgets/kurifilter.cpp +++ b/src/widgets/kurifilter.cpp @@ -179,7 +179,7 @@ wasModified(true), uriType(KUriFilterData::Unknown), searchFilterOptions(KUriFilterData::SearchFilterOptionNone), - url(u), + url(u.adjusted(QUrl::NormalizePathSegments)), typedString(typedUrl) { } @@ -195,7 +195,7 @@ uriType = KUriFilterData::Unknown; searchFilterOptions = KUriFilterData::SearchFilterOptionNone; - url = u; + url = u.adjusted(QUrl::NormalizePathSegments); typedString = typedUrl; errMsg.clear(); @@ -497,7 +497,7 @@ void KUriFilterPlugin::setFilteredUri(KUriFilterData &data, const QUrl &uri) const { - data.d->url = uri; + data.d->url = uri.adjusted(QUrl::NormalizePathSegments); data.d->wasModified = true; //qDebug() << "Got filtered to:" << uri; }