Download: Remove useless code and add a test
authorOlivier Goffart <ogoffart@woboq.com>
Thu, 28 Feb 2019 13:33:37 +0000 (14:33 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:57:50 +0000 (10:57 +0100)
From issue #7015, the code is wrong because the path is the file system path and
not the path on the DB.
But since this is a conflict, this means the reconcile will still want to download
the file from the server next sync, so we need not to worry about this case

src/libsync/owncloudpropagator.h
src/libsync/propagatedownload.cpp
src/libsync/syncengine.h

index 4b34913e51b5125112759ece5a72a7a4b674ea01..39419cd5b2da5b93a7007b2411e08148e1d32a64 100644 (file)
@@ -354,7 +354,7 @@ public:
     }
 };
 
-class OwncloudPropagator : public QObject
+class OWNCLOUDSYNC_EXPORT OwncloudPropagator : public QObject
 {
     Q_OBJECT
 public:
index 9504ea6f0416090a0b2bb2fe2067138eef5aa9cd..a14af832d42138f83dd9d7e07c927e1326d8c190 100644 (file)
@@ -939,19 +939,6 @@ void PropagateDownloadFile::downloadFinished()
     // The fileChanged() check is done above to generate better error messages.
     if (!FileSystem::uncheckedRenameReplace(_tmpFile.fileName(), fn, &error)) {
         qCWarning(lcPropagateDownload) << QString("Rename failed: %1 => %2").arg(_tmpFile.fileName()).arg(fn);
-
-        // If we moved away the original file due to a conflict but can't
-        // put the downloaded file in its place, we are in a bad spot:
-        // If we do nothing the next sync run will assume the user deleted
-        // the file!
-        // To avoid that, the file is removed from the metadata table entirely
-        // which makes it look like we're just about to initially download
-        // it.
-        if (isConflict) {
-            propagator()->_journal->deleteFileRecord(fn);
-            propagator()->_journal->commit("download finished");
-        }
-
         // If the file is locked, we want to retry this sync when it
         // becomes available again, otherwise try again directly
         if (FileSystem::isFileLocked(fn)) {
index 89d018b6da1eb25e3a6380ff7f4e9c376a2c8d77..df9138e0d9e9d4db8ce7e24e8df4e87664d7b842 100644 (file)
@@ -126,6 +126,8 @@ public:
     /** Access the last sync run's local discovery style */
     LocalDiscoveryStyle lastLocalDiscoveryStyle() const { return _lastLocalDiscoveryStyle; }
 
+    auto getPropagator() { return _propagator; } // for the test
+
 signals:
     void csyncUnavailable();