Skip to content

Commit

Permalink
Merge pull request #6299 from nextcloud/backport/6297/stable-3.10
Browse files Browse the repository at this point in the history
[stable-3.10] ensure we do not modify a file that has been just uploaded
  • Loading branch information
allexzander authored Dec 15, 2023
2 parents 9da5f42 + 33ede07 commit 519ebc4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
4 changes: 2 additions & 2 deletions src/libsync/syncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)

// Ensure it's a placeholder file on disk
if (item->_type == ItemTypeFile && _syncOptions._vfs->mode() != Vfs::Off) {
const auto result = _syncOptions._vfs->convertToPlaceholder(filePath, *item);
const auto result = _syncOptions._vfs->convertToPlaceholder(filePath, *item, {}, Vfs::UpdateMetadataType::DatabaseMetadata);
if (!result) {
item->_status = SyncFileItem::Status::NormalError;
item->_instruction = CSYNC_INSTRUCTION_ERROR;
Expand Down Expand Up @@ -411,7 +411,7 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
emit itemCompleted(item, ErrorCategory::GenericError);
return;
}
} else if (modificationHappened || prev._modtime != item->_modtime) {
} else if (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);
Expand Down
3 changes: 2 additions & 1 deletion test/testsyncengine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,8 @@ class TestSyncEngine : public QObject
private slots:
void initTestCase()
{
OCC::Logger::instance()->setLogDebug(true);
Logger::instance()->setLogFlush(true);
Logger::instance()->setLogDebug(true);
}

void testFileDownload() {
Expand Down

0 comments on commit 519ebc4

Please sign in to comment.