From 1b4a22c9ba8352856827d9ec039a53fea7f2d5e7 Mon Sep 17 00:00:00 2001 From: "Marco A. Zimmer" Date: Wed, 5 Oct 2016 10:19:32 +0200 Subject: [PATCH] fixed bugs local sync conflicts --- Sailfish/ownNotes/python/sync.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Sailfish/ownNotes/python/sync.py b/Sailfish/ownNotes/python/sync.py index 6d90b99..65fbb7e 100755 --- a/Sailfish/ownNotes/python/sync.py +++ b/Sailfish/ownNotes/python/sync.py @@ -109,6 +109,11 @@ def get_files_index(self,): pass return index + + def move(self, relpathfrom, relpathto): + pathfrom = self.get_abspath(relpathfrom) + pathto = self.get_abspath(relpathto) + os.rename(pathfrom, pathto) def rm(self, relpath): path = self.get_abspath(relpath) @@ -520,15 +525,15 @@ def _conflictLocal(self, wdc, ldc, relpath): conflict_path = os.path.splitext(relpath)[0] + '.Conflict.txt' # FIXME - ldc.rename(relpath, conflict_path) + ldc.move(relpath, conflict_path) self._download(wdc, ldc, relpath) # Test if it s a real conflict - if ldc.getsize(relpath) == 0: # Test size to avoid ownCloud Bug - ldc.remove(relpath) - ldc.rename(conflict_path, relpath) + if ldc.get_size(relpath) == 0: # Test size to avoid ownCloud Bug + ldc.rm(relpath) + ldc.move(conflict_path, relpath) elif ldc.get_md5(relpath) == ldc.get_md5(conflict_path): - ldc.remove(conflict_path) + ldc.rm(conflict_path) else: self._upload(wdc, ldc, conflict_path)