[Pkg-owncloud-commits] [owncloud-client] 114/159: Propagate download: Fix restoring files for which the conflict file exists

Sandro Knauß hefee-guest at moszumanska.debian.org
Fri May 1 13:05:32 UTC 2015


This is an automated email from the git hooks/post-receive script.

hefee-guest pushed a commit to branch master
in repository owncloud-client.

commit 8bb4af067a1fbb5173324137d23bd4323d5d4b4f
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Thu Apr 16 11:21:39 2015 +0200

    Propagate download: Fix restoring files for which the conflict file exists
    
    For issue #3106
    
    1) Always use the actual timestamp from the file in the file system
    to create the conflict file.  This is important because if one edit a
    file several time, they should have different name. Also it makes more
    sens to have the mtime of the modified file.
    
    2) Give the correct size to the job so we know when the temporary file
    is complete in case of resuming.
---
 src/libsync/propagator_legacy.cpp | 3 ++-
 src/libsync/syncengine.cpp        | 2 +-
 2 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/libsync/propagator_legacy.cpp b/src/libsync/propagator_legacy.cpp
index dc714b6..b9dc7e8 100644
--- a/src/libsync/propagator_legacy.cpp
+++ b/src/libsync/propagator_legacy.cpp
@@ -695,7 +695,8 @@ void PropagateDownloadFileLegacy::start()
         && !FileSystem::fileEquals(fn, tmpFile.fileName()); // compare the files to see if there was an actual conflict.
     //In case of conflict, make a backup of the old file
     if (isConflict) {
-        QString conflictFileName = makeConflictFileName(fn, Utility::qDateTimeFromTime_t(_item._modtime));
+        auto conflictDate = FileSystem::fileExists(fn) ? FileSystem::getModTime(fn) : _item._modtime;
+        QString conflictFileName = makeConflictFileName(fn, Utility::qDateTimeFromTime_t(conflictDate));
         QString renameError;
         if (!FileSystem::rename(fn, conflictFileName, &renameError)) {
             //If the rename fails, don't replace it.
diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp
index d8fa74a..81d0872 100644
--- a/src/libsync/syncengine.cpp
+++ b/src/libsync/syncengine.cpp
@@ -999,8 +999,8 @@ void SyncEngine::checkForPermission()
                     it->_direction = SyncFileItem::Down;
                     it->_isRestoration = true;
                     // take the things to write to the db from the "other" node (i.e: info from server)
-                    // ^^ FIXME This might not be needed anymore since we merge the info in treewalkFile
                     it->_modtime = it->log._other_modtime;
+                    it->_size = it->log._other_size;
                     it->_fileId = it->log._other_fileId;
                     it->_etag = it->log._other_etag;
                     it->_errorString = tr("Not allowed to upload this file because it is read-only on the server, restoring");

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git



More information about the Pkg-owncloud-commits mailing list