From 99927f15f972c856b5f280c60e8d73d08b187117 Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Tue, 22 Oct 2024 14:49:51 +0200 Subject: [PATCH] content access denied error during discovery: verify server access will trigger a check of the server connectivity in case of content access denied reporting when listing folders during discovery should allow discovering early that terms of service need to be signed Signed-off-by: Matthieu Gallien --- src/gui/accountstate.cpp | 4 ++++ src/libsync/account.h | 1 + src/libsync/discoveryphase.cpp | 4 ++++ 3 files changed, 9 insertions(+) diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index a69f5ef17356c..59f26fe7cc54e 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -64,6 +64,10 @@ AccountState::AccountState(const AccountPtr &account) this, &AccountState::slotPushNotificationsReady); connect(account.data(), &Account::serverUserStatusChanged, this, &AccountState::slotServerUserStatusChanged); + connect(account.data(), &Account::termsOfServiceNeedToBeChecked, + this, [this] () { + checkConnectivity(); + }); connect(this, &AccountState::isConnectedChanged, [=]{ // Get the Apps available on the server if we're now connected. diff --git a/src/libsync/account.h b/src/libsync/account.h index 4afd9f654dc37..92a132ef6c48d 100644 --- a/src/libsync/account.h +++ b/src/libsync/account.h @@ -464,6 +464,7 @@ public slots: void downloadLimitSettingChanged(); void uploadLimitChanged(); void downloadLimitChanged(); + void termsOfServiceNeedToBeChecked(); protected Q_SLOTS: void slotCredentialsFetched(); diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index 38e4a424c5a73..4cb604b9aa7da 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -652,6 +652,10 @@ void DiscoverySingleDirectoryJob::lsJobFinishedWithErrorSlot(QNetworkReply *r) msg = tr("Server error: PROPFIND reply is not XML formatted!"); } + if (r->error() == QNetworkReply::ContentAccessDenied) { + emit _account->termsOfServiceNeedToBeChecked(); + } + emit finished(HttpError{ httpCode, msg }); deleteLater(); }