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>2020-12-01 14:59:31 +0300
committerHannah von Reth <vonreth@kde.org>2020-12-09 13:52:03 +0300
commit75e363a6954c2231ba4eac360d7c3fbb4d9f34d4 (patch)
tree2a0c4fcbf056ee4fca598585a1b1069e4160d2a1 /src/gui/accountstate.cpp
parentd2a7580637ecd4a63a7efad8b179d9a46d65d3af (diff)
Handle url rediredcts with changed trailing slashes
Diffstat (limited to 'src/gui/accountstate.cpp')
-rw-r--r--src/gui/accountstate.cpp29
1 files changed, 21 insertions, 8 deletions
diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp
index ef3286704..86cc4bdc0 100644
--- a/src/gui/accountstate.cpp
+++ b/src/gui/accountstate.cpp
@@ -33,20 +33,33 @@ Q_LOGGING_CATEGORY(lcAccountState, "gui.account.state", QtInfoMsg)
void AccountState::updateUrlDialog(AccountPtr account, const QUrl &newUrl, std::function<void()> callback)
{
- auto diag = 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());
- diag->setAttribute(Qt::WA_DeleteOnClose);
- auto yes = diag->addButton(tr("Change url permanently to %1").arg(newUrl.toString()), QMessageBox::AcceptRole);
- diag->addButton(tr("Reject"), QMessageBox::RejectRole);
- QObject::connect(diag, &QMessageBox::finished, account.data(), [diag, yes, newUrl, account, callback] {
- if (diag->clickedButton() == yes) {
+ auto accept = [=](bool accepted) {
+ if (accepted) {
account->setUrl(newUrl);
Q_EMIT account->wantsAccountSaved(account.data());
}
if (callback) {
callback();
}
+ };
+ // the urls are identical, previous versions of owncloud cropped the /
+ if (newUrl.path() == QLatin1Char('/')) {
+ auto tmp = newUrl;
+ tmp.setPath(QString());
+ if (tmp == account->url()) {
+ // silently accept the /
+ accept(true);
+ return;
+ }
+ }
+ auto diag = 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());
+ diag->setAttribute(Qt::WA_DeleteOnClose);
+ auto yes = diag->addButton(tr("Change url permanently to %1").arg(newUrl.toString()), QMessageBox::AcceptRole);
+ diag->addButton(tr("Reject"), QMessageBox::RejectRole);
+ QObject::connect(diag, &QMessageBox::finished, account.data(), [diag, yes, accept] {
+ accept(diag->clickedButton() == yes);
});
diag->show();
}