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 <[email protected]>
  • Loading branch information
mgallien committed Oct 22, 2024
1 parent 8ddf11d commit 968289c
Show file tree
Hide file tree
Showing 3 changed files with 9 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 @@ -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.
Expand Down
1 change: 1 addition & 0 deletions src/libsync/account.h
Original file line number Diff line number Diff line change
Expand Up @@ -464,6 +464,7 @@ public slots:
void downloadLimitSettingChanged();
void uploadLimitChanged();
void downloadLimitChanged();
void termsOfServiceNeedToBeChecked();

protected Q_SLOTS:
void slotCredentialsFetched();
Expand Down
4 changes: 4 additions & 0 deletions src/libsync/discoveryphase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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();

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

View workflow job for this annotation

GitHub Actions / build

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

variable '_account' is not initialized
}

emit finished(HttpError{ httpCode, msg });

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

View workflow job for this annotation

GitHub Actions / build

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

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

0 comments on commit 968289c

Please sign in to comment.