From 4cc880eefed115ecbc1dfa5d8287f73282986211 Mon Sep 17 00:00:00 2001 From: Hannah von Reth Date: Fri, 18 Sep 2020 13:42:42 +0200 Subject: [PATCH] Don't show 404 errors when manually creating folder sync pair. Fixes: #7724 --- changelog/unreleased/7724 | 6 ++++++ src/gui/folderwizard.cpp | 30 ++++++++++++------------------ src/gui/folderwizard.h | 1 - 3 files changed, 18 insertions(+), 19 deletions(-) create mode 100644 changelog/unreleased/7724 diff --git a/changelog/unreleased/7724 b/changelog/unreleased/7724 new file mode 100644 index 00000000000..13845a7c88c --- /dev/null +++ b/changelog/unreleased/7724 @@ -0,0 +1,6 @@ +Change: When manually adding a folder sync connection, don't display 404 errors + +We no longer display 404 errors when exploring the folders. +A user might not have access to the full file tree on the server. + +https://github.com/owncloud/client/issues/7724 diff --git a/src/gui/folderwizard.cpp b/src/gui/folderwizard.cpp index 2b3e7fe57df..b42bfe1fcf7 100644 --- a/src/gui/folderwizard.cpp +++ b/src/gui/folderwizard.cpp @@ -110,7 +110,7 @@ bool FolderWizardLocalPath::isComplete() const _ui.warnLabel->setWordWrap(true); if (isOk) { _ui.warnLabel->hide(); - _ui.warnLabel->setText(QString()); + _ui.warnLabel->clear(); } else { _ui.warnLabel->show(); QString warnings = formatWarnings(warnStrings); @@ -230,8 +230,17 @@ void FolderWizardRemotePath::slotHandleMkdirNetworkError(QNetworkReply *reply) } } -void FolderWizardRemotePath::slotHandleLsColNetworkError(QNetworkReply * /*reply*/) +void FolderWizardRemotePath::slotHandleLsColNetworkError(QNetworkReply *reply) { + // Ignore 404s, otherwise users will get annoyed by error popups + // when not typing fast enough. It's still clear that a given path + // was not found, because the 'Next' button is disabled and no entry + // is selected in the tree view. + int httpCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); + if (httpCode == 404) { + showWarn(QString()); // hides the warning pane + return; + } auto job = qobject_cast(sender()); OC_ASSERT(job); showWarn(tr("Failed to list a folder. Error: %1") @@ -378,7 +387,7 @@ void FolderWizardRemotePath::slotLsColFolderEntry() // because of extra logic in the typed-path case. disconnect(job, nullptr, this, nullptr); connect(job, &LsColJob::finishedWithError, - this, &FolderWizardRemotePath::slotTypedPathError); + this, &FolderWizardRemotePath::slotHandleLsColNetworkError); connect(job, &LsColJob::directoryListingSubfolders, this, &FolderWizardRemotePath::slotTypedPathFound); } @@ -389,21 +398,6 @@ void FolderWizardRemotePath::slotTypedPathFound(const QStringList &subpaths) selectByPath(_ui.folderEntry->text()); } -void FolderWizardRemotePath::slotTypedPathError(QNetworkReply *reply) -{ - // Ignore 404s, otherwise users will get annoyed by error popups - // when not typing fast enough. It's still clear that a given path - // was not found, because the 'Next' button is disabled and no entry - // is selected in the tree view. - int httpCode = reply->attribute(QNetworkRequest::HttpStatusCodeAttribute).toInt(); - if (httpCode == 404) { - showWarn(""); // hides the warning pane - return; - } - - slotHandleLsColNetworkError(reply); -} - LsColJob *FolderWizardRemotePath::runLsColJob(const QString &path) { LsColJob *job = new LsColJob(_account, path, this); diff --git a/src/gui/folderwizard.h b/src/gui/folderwizard.h index 4a82b58ced2..8dfed314fde 100644 --- a/src/gui/folderwizard.h +++ b/src/gui/folderwizard.h @@ -102,7 +102,6 @@ protected slots: void slotFolderEntryEdited(const QString &text); void slotLsColFolderEntry(); void slotTypedPathFound(const QStringList &subpaths); - void slotTypedPathError(QNetworkReply *reply); private: LsColJob *runLsColJob(const QString &path);