From 504014178d6b730c9bc3a822a329a00aaddb173c Mon Sep 17 00:00:00 2001 From: alex-z Date: Thu, 15 Feb 2024 22:38:28 +0100 Subject: [PATCH] Remove desktop-specific error statuses that are not present on the server. Signed-off-by: alex-z --- src/libsync/clientstatusreportingcommon.cpp | 6 ------ src/libsync/clientstatusreportingcommon.h | 5 +---- src/libsync/clientstatusreportingnetwork.cpp | 3 --- src/libsync/owncloudpropagator.cpp | 4 ---- src/libsync/propagatedownload.cpp | 2 -- test/testclientstatusreporting.cpp | 9 +++++---- 6 files changed, 6 insertions(+), 23 deletions(-) diff --git a/src/libsync/clientstatusreportingcommon.cpp b/src/libsync/clientstatusreportingcommon.cpp index fabbf2b0fbbaf..a0d034aada086 100644 --- a/src/libsync/clientstatusreportingcommon.cpp +++ b/src/libsync/clientstatusreportingcommon.cpp @@ -27,8 +27,6 @@ QByteArray clientStatusstatusStringFromNumber(const ClientStatusReportingStatus } switch (status) { - case ClientStatusReportingStatus::DownloadError_Cannot_Create_File: - return QByteArrayLiteral("DownloadResult.CANNOT_CREATE_FILE"); case ClientStatusReportingStatus::DownloadError_Conflict: return QByteArrayLiteral("DownloadResult.CONFLICT"); case ClientStatusReportingStatus::DownloadError_ConflictCaseClash: @@ -37,8 +35,6 @@ QByteArray clientStatusstatusStringFromNumber(const ClientStatusReportingStatus return QByteArrayLiteral("DownloadResult.CONFLICT_INVALID_CHARACTERS"); case ClientStatusReportingStatus::DownloadError_No_Free_Space: return QByteArrayLiteral("DownloadResult.NO_FREE_SPACE"); - case ClientStatusReportingStatus::DownloadError_ServerError: - return QByteArrayLiteral("DownloadResult.SERVER_ERROR"); case ClientStatusReportingStatus::DownloadError_Virtual_File_Hydration_Failure: return QByteArrayLiteral("DownloadResult.VIRTUAL_FILE_HYDRATION_FAILURE"); case ClientStatusReportingStatus::E2EeError_GeneralError: @@ -51,8 +47,6 @@ QByteArray clientStatusstatusStringFromNumber(const ClientStatusReportingStatus return QByteArrayLiteral("UploadResult.NO_FREE_SPACE"); case ClientStatusReportingStatus::UploadError_No_Write_Permissions: return QByteArrayLiteral("UploadResult.NO_WRITE_PERMISSIONS"); - case ClientStatusReportingStatus::UploadError_ServerError: - return QByteArrayLiteral("UploadResult.SERVER_ERROR"); case ClientStatusReportingStatus::UploadError_Virus_Detected: return QByteArrayLiteral("UploadResult.VIRUS_DETECTED"); case ClientStatusReportingStatus::Count: diff --git a/src/libsync/clientstatusreportingcommon.h b/src/libsync/clientstatusreportingcommon.h index 4e08ca1efa6fd..7d331c34d2bd8 100644 --- a/src/libsync/clientstatusreportingcommon.h +++ b/src/libsync/clientstatusreportingcommon.h @@ -18,19 +18,16 @@ namespace OCC { enum class ClientStatusReportingStatus { - DownloadError_Cannot_Create_File = 0, - DownloadError_Conflict, + DownloadError_Conflict = 0, DownloadError_ConflictCaseClash, DownloadError_ConflictInvalidCharacters, DownloadError_No_Free_Space, - DownloadError_ServerError, DownloadError_Virtual_File_Hydration_Failure, E2EeError_GeneralError, UploadError_Conflict, UploadError_ConflictInvalidCharacters, UploadError_No_Free_Space, UploadError_No_Write_Permissions, - UploadError_ServerError, UploadError_Virus_Detected, Count, }; diff --git a/src/libsync/clientstatusreportingnetwork.cpp b/src/libsync/clientstatusreportingnetwork.cpp index ed0f669f8411c..c60c69a4a777e 100644 --- a/src/libsync/clientstatusreportingnetwork.cpp +++ b/src/libsync/clientstatusreportingnetwork.cpp @@ -175,13 +175,10 @@ QByteArray ClientStatusReportingNetwork::classifyStatus(const ClientStatusReport case ClientStatusReportingStatus::UploadError_Conflict: case ClientStatusReportingStatus::UploadError_ConflictInvalidCharacters: return statusReportCategorySyncConflicts; - case ClientStatusReportingStatus::DownloadError_Cannot_Create_File: case ClientStatusReportingStatus::DownloadError_No_Free_Space: - case ClientStatusReportingStatus::DownloadError_ServerError: case ClientStatusReportingStatus::DownloadError_Virtual_File_Hydration_Failure: case ClientStatusReportingStatus::UploadError_No_Free_Space: case ClientStatusReportingStatus::UploadError_No_Write_Permissions: - case ClientStatusReportingStatus::UploadError_ServerError: return statusReportCategoryProblems; case ClientStatusReportingStatus::UploadError_Virus_Detected: return statusReportCategoryVirus; diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index 6664be246616b..cd91c0b34190e 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -351,11 +351,7 @@ void PropagateItemJob::reportClientStatuses() && _item->_errorExceptionName.contains(QStringLiteral("UnsupportedMediaType")) && _item->_errorExceptionMessage.contains(QStringLiteral("virus"), Qt::CaseInsensitive)) { propagator()->account()->reportClientStatus(ClientStatusReportingStatus::UploadError_Virus_Detected); - } else { - propagator()->account()->reportClientStatus(ClientStatusReportingStatus::UploadError_ServerError); } - } else { - propagator()->account()->reportClientStatus(ClientStatusReportingStatus::DownloadError_ServerError); } } } diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index caa6922dbdb24..11b9935a4e6ca 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -675,7 +675,6 @@ void PropagateDownloadFile::startDownload() if (_tmpFile.exists()) FileSystem::setFileReadOnly(_tmpFile.fileName(), false); if (!_tmpFile.open(QIODevice::Append | QIODevice::Unbuffered)) { - propagator()->account()->reportClientStatus(ClientStatusReportingStatus::DownloadError_Cannot_Create_File); qCWarning(lcPropagateDownload) << "could not open temporary file" << _tmpFile.fileName(); done(SyncFileItem::NormalError, _tmpFile.errorString(), ErrorCategory::GenericError); return; @@ -1260,7 +1259,6 @@ void PropagateDownloadFile::downloadFinished() emit propagator()->touchedFile(filename); // The fileChanged() check is done above to generate better error messages. if (!FileSystem::uncheckedRenameReplace(_tmpFile.fileName(), filename, &error)) { - propagator()->account()->reportClientStatus(ClientStatusReportingStatus::DownloadError_Cannot_Create_File); qCWarning(lcPropagateDownload) << QString("Rename failed: %1 => %2").arg(_tmpFile.fileName()).arg(filename); // If the file is locked, we want to retry this sync when it // becomes available again, otherwise try again directly diff --git a/test/testclientstatusreporting.cpp b/test/testclientstatusreporting.cpp index d2ca07244b3c2..38f9e3f8fa3a7 100644 --- a/test/testclientstatusreporting.cpp +++ b/test/testclientstatusreporting.cpp @@ -83,13 +83,14 @@ private slots: account->reportClientStatus(OCC::ClientStatusReportingStatus::DownloadError_ConflictCaseClash); // 4 problems - account->reportClientStatus(OCC::ClientStatusReportingStatus::UploadError_ServerError); - account->reportClientStatus(OCC::ClientStatusReportingStatus::DownloadError_ServerError); + account->reportClientStatus(OCC::ClientStatusReportingStatus::UploadError_No_Free_Space); + account->reportClientStatus(OCC::ClientStatusReportingStatus::DownloadError_No_Free_Space); account->reportClientStatus(OCC::ClientStatusReportingStatus::DownloadError_Virtual_File_Hydration_Failure); // 3 occurances of case ClientStatusReportingStatus::UploadError_No_Write_Permissions account->reportClientStatus(OCC::ClientStatusReportingStatus::UploadError_No_Write_Permissions); account->reportClientStatus(OCC::ClientStatusReportingStatus::UploadError_No_Write_Permissions); account->reportClientStatus(OCC::ClientStatusReportingStatus::UploadError_No_Write_Permissions); + account->reportClientStatus(OCC::ClientStatusReportingStatus::UploadError_No_Write_Permissions); // 3 occurances of case ClientStatusReportingStatus::UploadError_Virus_Detected account->reportClientStatus(OCC::ClientStatusReportingStatus::UploadError_Virus_Detected); @@ -123,8 +124,8 @@ private slots: QVERIFY(!problemsReceived.isEmpty()); QCOMPARE(problemsReceived.size(), 4); const auto problemsNoWritePermissions = problemsReceived.value(OCC::clientStatusstatusStringFromNumber(OCC::ClientStatusReportingStatus::UploadError_No_Write_Permissions)).toMap(); - // among those, 3 occurances of case ClientStatusReportingStatus::UploadError_No_Write_Permissions - QCOMPARE(problemsNoWritePermissions.value("count"), 3); + // among those, 4 occurances of case ClientStatusReportingStatus::UploadError_No_Write_Permissions + QCOMPARE(problemsNoWritePermissions.value("count"), 4); bodyReceivedAndParsed.clear(); }