diff options
author | Matthieu Gallien <matthieu.gallien@nextcloud.com> | 2021-12-14 11:09:25 +0300 |
---|---|---|
committer | Matthieu Gallien <matthieu.gallien@nextcloud.com> | 2021-12-14 12:00:59 +0300 |
commit | 9a201a8963f4b94912b2ebb94093267ef6d92434 (patch) | |
tree | 9fe2e2e3840bf12c5d7d88379398e1052befd9d9 /src | |
parent | 5b696e5cf3e660c5f7425a387b74b03c23d6134e (diff) |
force download from server for local files that have invalid dates
will trigger if local state is incoherent
like the file itself haveing 0 or negative modtime and the database not
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/libsync/discovery.cpp | 8 | ||||
-rw-r--r-- | src/libsync/filesystem.cpp | 2 |
2 files changed, 9 insertions, 1 deletions
diff --git a/src/libsync/discovery.cpp b/src/libsync/discovery.cpp index b673d4c98..605bb1a0b 100644 --- a/src/libsync/discovery.cpp +++ b/src/libsync/discovery.cpp @@ -953,6 +953,14 @@ void ProcessDirectoryJob::processFileAnalyzeLocalInfo( item->_modtime = localEntry.modtime; item->_type = localEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile; _childModified = true; + } else if (dbEntry._modtime > 0 && localEntry.modtime <= 0) { + item->_instruction = CSYNC_INSTRUCTION_SYNC; + item->_direction = SyncFileItem::Down; + item->_size = localEntry.size > 0 ? localEntry.size : dbEntry._fileSize; + item->_modtime = dbEntry._modtime; + item->_previousModtime = dbEntry._modtime; + item->_type = localEntry.isDirectory ? ItemTypeDirectory : ItemTypeFile; + _childModified = true; } else { // Local file was changed item->_instruction = CSYNC_INSTRUCTION_SYNC; diff --git a/src/libsync/filesystem.cpp b/src/libsync/filesystem.cpp index d0e9d673e..b63745fed 100644 --- a/src/libsync/filesystem.cpp +++ b/src/libsync/filesystem.cpp @@ -98,7 +98,7 @@ bool FileSystem::verifyFileUnchanged(const QString &fileName, { const qint64 actualSize = getSize(fileName); const time_t actualMtime = getModTime(fileName); - if (actualSize != previousSize || (actualMtime != previousMtime && previousMtime > 0 && actualMtime > 0)) { + if ((actualSize != previousSize && actualMtime > 0) || (actualMtime != previousMtime && previousMtime > 0 && actualMtime > 0)) { qCInfo(lcFileSystem) << "File" << fileName << "has changed:" << "size: " << previousSize << "<->" << actualSize << ", mtime: " << previousMtime << "<->" << actualMtime; |