Skip to content

Commit

Permalink
content access denied error during discovery: verify server access
Browse files Browse the repository at this point in the history
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 <matthieu.gallien@nextcloud.com>
  • Loading branch information
mgallien committed Oct 22, 2024
1 parent 4bc870f commit c2871c2
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/gui/accountstate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,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.
Expand Down
2 changes: 2 additions & 0 deletions src/libsync/account.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,8 @@ public slots:
void lockFileSuccess();
void lockFileError(const QString&);

void termsOfServiceNeedToBeChecked();

protected Q_SLOTS:
void slotCredentialsFetched();
void slotCredentialsAsked();
Expand Down
4 changes: 4 additions & 0 deletions src/libsync/discoveryphase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -651,6 +651,10 @@ void DiscoverySingleDirectoryJob::lsJobFinishedWithErrorSlot(QNetworkReply *r)
msg = tr("Server error: PROPFIND reply is not XML formatted!");
}

if (r->error() == QNetworkReply::ContentAccessDenied) {
emit _account->termsOfServiceNeedToBeChecked();

Check warning on line 655 in src/libsync/discoveryphase.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/discoveryphase.cpp:655:14 [cppcoreguidelines-init-variables]

variable '_account' is not initialized
}

emit finished(HttpError{ httpCode, msg });

Check warning on line 658 in src/libsync/discoveryphase.cpp

View workflow job for this annotation

GitHub Actions / build

src/libsync/discoveryphase.cpp:658:10 [cppcoreguidelines-init-variables]

variable 'finished' is not initialized
deleteLater();
}
Expand Down

0 comments on commit c2871c2

Please sign in to comment.