Don't fatal on "Storage temporarily unavailable"
authorChristian Kamm <mail@ckamm.de>
Mon, 12 Aug 2019 07:07:56 +0000 (09:07 +0200)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:57 +0000 (10:58 +0100)
This is an unreliable workaround. The real fix will need to be deferred
to another release.

For #5088

src/libsync/owncloudpropagator_p.h

index 6b4ad374809c678a74b97ee0cbf77557d99ee5b7..d6ae07a3ae0857b693481051744f3c71bd5d1858 100644 (file)
@@ -59,8 +59,13 @@ inline SyncFileItem::Status classifyError(QNetworkReply::NetworkError nerror,
     if (httpCode == 503) {
         // When the server is in maintenance mode, we want to exit the sync immediatly
         // so that we do not flood the server with many requests
-        return errorBody.contains(R"(>Sabre\DAV\Exception\ServiceUnavailable<)") ?
-            SyncFileItem::FatalError : SyncFileItem::NormalError;
+        // BUG: This relies on a translated string and is thus unreliable.
+        //      In the future it should return a NormalError and trigger a status.php
+        //      check that detects maintenance mode reliably and will terminate the sync run.
+        auto probablyMaintenance =
+                errorBody.contains(R"(>Sabre\DAV\Exception\ServiceUnavailable<)")
+                && !errorBody.contains("Storage is temporarily not available");
+        return probablyMaintenance ? SyncFileItem::FatalError : SyncFileItem::NormalError;
     }
 
     if (httpCode == 412) {