Skip to content

Commit

Permalink
Ensure file modification time is set if item modtime differs from jou…
Browse files Browse the repository at this point in the history
…rnal modtime

Signed-off-by: Claudio Cambra <[email protected]>
  • Loading branch information
claucambra committed Aug 4, 2023
1 parent 757491f commit ac39d32
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions src/libsync/syncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -388,17 +388,17 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
}

// Update on-disk virtual file metadata
if (modificationHappened) {
if (item->_type == ItemTypeVirtualFile) {
auto r = _syncOptions._vfs->updateMetadata(filePath, item->_modtime, item->_size, item->_fileId);
if (!r) {
item->_status = SyncFileItem::Status::NormalError;
item->_instruction = CSYNC_INSTRUCTION_ERROR;
item->_errorString = tr("Could not update virtual file metadata: %1").arg(r.error());
emit itemCompleted(item, ErrorCategory::GenericError);
return;
}
} else if (!FileSystem::setModTime(filePath, item->_modtime)) {
if (modificationHappened && item->_type == ItemTypeVirtualFile) {
auto r = _syncOptions._vfs->updateMetadata(filePath, item->_modtime, item->_size, item->_fileId);
if (!r) {
item->_status = SyncFileItem::Status::NormalError;
item->_instruction = CSYNC_INSTRUCTION_ERROR;
item->_errorString = tr("Could not update virtual file metadata: %1").arg(r.error());
emit itemCompleted(item, ErrorCategory::GenericError);
return;
}
} else if (modificationHappened || prev._modtime != item->_modtime) {
if (!FileSystem::setModTime(filePath, item->_modtime)) {
item->_instruction = CSYNC_INSTRUCTION_ERROR;
item->_errorString = tr("Could not update file metadata: %1").arg(filePath);
emit itemCompleted(item, ErrorCategory::GenericError);
Expand Down

0 comments on commit ac39d32

Please sign in to comment.