Download: Retrigger folder discovery on 404
authorChristian Kamm <mail@ckamm.de>
Mon, 29 May 2017 10:05:22 +0000 (12:05 +0200)
committerMarkus Goetz <markus@woboq.com>
Mon, 29 May 2017 19:41:10 +0000 (21:41 +0200)
See owncloud/enterprise#1966

If the server and the client's database go out of sync, there could be
persistent 404 errors. This change ensures that the problem corrects
itself eventually by triggering a remote discovery of the file's
parent folders.

It does not address the root cause that might have lead to the
divergence.

src/libsync/propagatedownload.cpp

index e87e3d45bf2405cc7cfdb83417bf8763277cddb3..0ad605dc84b099fcbdbea6a3eb088bc510ff1ba5 100644 (file)
@@ -500,6 +500,11 @@ void PropagateDownloadFile::slotGetFinished()
         } else if (fileNotFound) {
             job->setErrorString(tr("File was deleted from server"));
             job->setErrorStatus(SyncFileItem::SoftError);
+
+            // As a precaution against bugs that cause our database and the
+            // reality on the server to diverge, rediscover this folder on the
+            // next sync run.
+            propagator()->_journal->avoidReadFromDbOnNextSync(_item->_file);
         }
 
         SyncFileItem::Status status = job->errorStatus();