Просмотр исходного кода

Download: Remove useless code and add a test

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
Olivier Goffart 7 лет назад
Родитель
Сommit
4eb8997519
3 измененных файлов с 3 добавлено и 14 удалено
  1. 1 1
      src/libsync/owncloudpropagator.h
  2. 0 13
      src/libsync/propagatedownload.cpp
  3. 2 0
      src/libsync/syncengine.h

+ 1 - 1
src/libsync/owncloudpropagator.h

@@ -354,7 +354,7 @@ public:
     }
 };
 
-class OwncloudPropagator : public QObject
+class OWNCLOUDSYNC_EXPORT OwncloudPropagator : public QObject
 {
     Q_OBJECT
 public:

+ 0 - 13
src/libsync/propagatedownload.cpp

@@ -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)) {

+ 2 - 0
src/libsync/syncengine.h

@@ -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();