Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't show 404 errors when manually creating folder sync pair. #8101

Merged
merged 1 commit into from
Sep 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions changelog/unreleased/7724
Original file line number Diff line number Diff line change
@@ -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
30 changes: 12 additions & 18 deletions src/gui/folderwizard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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<LsColJob *>(sender());
OC_ASSERT(job);
showWarn(tr("Failed to list a folder. Error: %1")
Expand Down Expand Up @@ -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);
}
Expand All @@ -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);
Expand Down
1 change: 0 additions & 1 deletion src/gui/folderwizard.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down