Skip to content

Commit

Permalink
force download from server for local files that have invalid dates
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
mgallien committed Dec 14, 2021
1 parent 5b696e5 commit 9a201a8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/libsync/discovery.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/libsync/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 9a201a8

Please sign in to comment.