Skip to content

Commit

Permalink
Remove desktop-specific error statuses that are not present on the se…
Browse files Browse the repository at this point in the history
…rver.

Signed-off-by: alex-z <[email protected]>
  • Loading branch information
allexzander committed Feb 15, 2024
1 parent 5511d69 commit 5040141
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 23 deletions.
6 changes: 0 additions & 6 deletions src/libsync/clientstatusreportingcommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
Expand All @@ -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:
Expand Down
5 changes: 1 addition & 4 deletions src/libsync/clientstatusreportingcommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
};
Expand Down
3 changes: 0 additions & 3 deletions src/libsync/clientstatusreportingnetwork.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
4 changes: 0 additions & 4 deletions src/libsync/owncloudpropagator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/libsync/propagatedownload.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
Expand Down
9 changes: 5 additions & 4 deletions test/testclientstatusreporting.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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();
}
Expand Down

0 comments on commit 5040141

Please sign in to comment.