Skip to content

Commit

Permalink
Merge pull request #4074 from nextcloud/bugfix/forceDownloadLocalInva…
Browse files Browse the repository at this point in the history
…lidFiles

Bugfix/force download local invalid files
  • Loading branch information
mgallien authored Dec 14, 2021
2 parents 5b696e5 + 9a201a8 commit b021460
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 b021460

Please sign in to comment.