Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/owncloud/client.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHannah von Reth <hannah.vonreth@owncloud.com>2021-05-21 13:33:30 +0300
committerHannah von Reth <vonreth@kde.org>2021-05-26 18:11:27 +0300
commit286d6229a78067b4a4b14142d0be287037a934e7 (patch)
treed7ad6a072d9733762f1f788c45a56e9ac6afb791 /src/gui/accountstate.cpp
parentf37bf34ed261337298291bfeb3493678f7a6326c (diff)
Fix url compare on redirects
Fixes: #8645
Diffstat (limited to 'src/gui/accountstate.cpp')
-rw-r--r--src/gui/accountstate.cpp27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp
index 6f782bec4..769894a2c 100644
--- a/src/gui/accountstate.cpp
+++ b/src/gui/accountstate.cpp
@@ -44,20 +44,23 @@ void AccountState::updateUrlDialog(const QUrl &newUrl)
Q_EMIT urlUpdated();
};
- // the urls are identical, previous versions of owncloud cropped the /
- auto newPath = newUrl.path();
- if (newPath.endsWith(QLatin1Char('/'))) {
- newPath.truncate(1);
- }
- if (newPath == _account->url().path()) {
- auto tmp = newUrl;
- tmp.setPath(QString());
- if (tmp == _account->url()) {
- // silently accept the /
- accept();
- return;
+ auto matchUrl = [](QUrl url1, QUrl url2) {
+ // ensure https://demo.owncloud.org/ matches https://demo.owncloud.org
+ // the empty path was the legacy formating before 2.9
+ if (url1.path().isEmpty()) {
+ url1.setPath(QStringLiteral("/"));
+ }
+ if (url2.path().isEmpty()) {
+ url2.setPath(QStringLiteral("/"));
}
+ return url1.matches(url2, QUrl::StripTrailingSlash | QUrl::NormalizePathSegments);
+ };
+
+ if (matchUrl(newUrl, _account->url())) {
+ accept();
+ return;
}
+
_updateUrlDialog = new QMessageBox(QMessageBox::Warning, tr("Url update requested for %1").arg(_account->displayName()),
tr("The url for %1 changed from %2 to %3, do you want to accept the changed url?").arg(_account->displayName(), _account->url().toString(), newUrl.toString()),
QMessageBox::NoButton, ocApp()->gui()->settingsDialog());