From 0efbfb10aac28a0e111d8e67fdfe745551416d08 Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Thu, 17 Oct 2013 12:57:05 +0200 Subject: [PATCH] Fix MOVE of directory. Remove the right entry from the database (i.e: the original file name) Fetch the etags of the sub entries --- src/mirall/csyncthread.cpp | 2 +- src/mirall/owncloudpropagator.cpp | 10 +++++++++- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/mirall/csyncthread.cpp b/src/mirall/csyncthread.cpp index 16726229c7..098bf6d376 100644 --- a/src/mirall/csyncthread.cpp +++ b/src/mirall/csyncthread.cpp @@ -483,7 +483,7 @@ void CSyncThread::transferCompleted(const SyncFileItem &item) /* Update the database */ if (item._instruction == CSYNC_INSTRUCTION_DELETED) { - _journal->deleteFileRecord(item._file); + _journal->deleteFileRecord(item._originalFile); if (!item._renameTarget.isEmpty()) { SyncJournalFileRecord record(item, _localPath + item._renameTarget); record._path = item._renameTarget; diff --git a/src/mirall/owncloudpropagator.cpp b/src/mirall/owncloudpropagator.cpp index 8e461cf674..2bfe12bb9e 100644 --- a/src/mirall/owncloudpropagator.cpp +++ b/src/mirall/owncloudpropagator.cpp @@ -645,8 +645,16 @@ csync_instructions_e OwncloudPropagator::downloadFile(const SyncFileItem &item, csync_instructions_e OwncloudPropagator::remoteRename(const SyncFileItem &item) { if (item._file == item._renameTarget) { + if (!item._isDirectory) { + // The parents has been renamed already so there is nothing more to do. + // But we still need to fetch the new ETAG + // FIXME maybe do a recusrsive propfind after having moced the parent. + // Note: we also update the mtime because the server do not keep the mtime when moving files + QScopedPointer uri2(ne_path_escape((_remoteDir + item._renameTarget).toUtf8())); + updateMTimeAndETag(uri2.data(), item._modtime); + } _status = SyncFileItem::Success; - return CSYNC_INSTRUCTION_DELETED; // nothing to do; + return CSYNC_INSTRUCTION_DELETED; } // Check if it is the toplevel Shared folder and do not propagate it.