diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index 1dd9ae88d42..19262e94fa0 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 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(); } diff --git a/src/libsync/networkjobs.cpp b/src/libsync/networkjobs.cpp index 8f01909b991..e70e2097f50 100644 --- a/src/libsync/networkjobs.cpp +++ b/src/libsync/networkjobs.cpp @@ -505,11 +505,7 @@ void CheckServerJob::metaDataChangedSlot() bool CheckServerJob::finished() { - const QUrl targetUrl = [this] { - QUrl redirectUrl = reply()->url(); - redirectUrl.setPath(redirectUrl.path().remove(QStringLiteral("/status.php"))); - return redirectUrl; - }(); + const QUrl targetUrl = reply()->url().adjusted(QUrl::RemoveFilename); if (targetUrl.scheme() == QLatin1String("https") && reply()->sslConfiguration().sessionTicket().isEmpty() && reply()->error() == QNetworkReply::NoError) {