From 8fb3380fbb880aaa4ed31be18df752be08fb4871 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 | 2 ++ src/libsync/discoveryphase.cpp | 4 ++++ 3 files changed, 10 insertions(+) diff --git a/src/gui/accountstate.cpp b/src/gui/accountstate.cpp index c5393885d6dec..3c55cbfeb5c1f 100644 --- a/src/gui/accountstate.cpp +++ b/src/gui/accountstate.cpp @@ -60,6 +60,10 @@ AccountState::AccountState(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 b7702e525fdf8..6e38f75c25180 100644 --- a/src/libsync/account.h +++ b/src/libsync/account.h @@ -378,6 +378,8 @@ public slots: void lockFileSuccess(); void lockFileError(const QString&); + void termsOfServiceNeedToBeChecked(); + protected Q_SLOTS: void slotCredentialsFetched(); void slotCredentialsAsked(); diff --git a/src/libsync/discoveryphase.cpp b/src/libsync/discoveryphase.cpp index b6b383e3c9ae6..91fe904c44fba 100644 --- a/src/libsync/discoveryphase.cpp +++ b/src/libsync/discoveryphase.cpp @@ -653,6 +653,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(); }