From 98bfa8d5de0b553262bb0107a4b68d45a8870dcc Mon Sep 17 00:00:00 2001 From: Olivier Goffart Date: Wed, 21 Sep 2016 16:35:42 +0200 Subject: [PATCH] Propagator: properly send the success flag (#5189) In case of the root directory, it may happen that the _item is empty and the _item->_status is NoStatus. But we still need to report the proper success or error of the whole propagation. We should really use _hasError for that. However, _hasError is also defined to NoStatus if there was no error, so in that case we need to set Success. This fixes the problem in which the data-fingerprint is not saved on the database because the SyncEngine think that the sync failed. (Issue #5185) --- src/libsync/owncloudpropagator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/libsync/owncloudpropagator.cpp b/src/libsync/owncloudpropagator.cpp index d73f63c76..c875dcfd7 100644 --- a/src/libsync/owncloudpropagator.cpp +++ b/src/libsync/owncloudpropagator.cpp @@ -686,14 +686,14 @@ void PropagateDirectory::finalize() SyncJournalFileRecord record(*_item, _propagator->_localDir + _item->_file); ok = _propagator->_journal->setFileRecordMetadata(record); if (!ok) { - _item->_status = SyncFileItem::FatalError; + _hasError = _item->_status = SyncFileItem::FatalError; _item->_errorString = tr("Error writing metadata to the database"); qWarning() << "Error writing to the database for file" << _item->_file; } } } _state = Finished; - emit finished(_item->_status); + emit finished(_hasError == SyncFileItem::NoStatus ? SyncFileItem::Success : _hasError); } qint64 PropagateDirectory::committedDiskSpace() const