let error during update of metadata of virtual files propagate to users
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 2 Mar 2022 11:06:16 +0000 (12:06 +0100)
committerMatthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr>
Thu, 17 Mar 2022 23:28:02 +0000 (23:28 +0000)
errors duing update of metadata of virtual files are being ignored and
not propagated to users to be shonw in main dialog

ensure they are real errors from sync engine point of view and let them
be taken into account

Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/libsync/syncengine.cpp

index 3ce782e3c8be294659c5a19af8d39bc4bb81851e..0306e0f8c9549c7ee633314bb6fe76ad71b98fb1 100644 (file)
@@ -353,8 +353,10 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
             if (item->_type == ItemTypeFile) {
                 const auto result = _syncOptions._vfs->convertToPlaceholder(filePath, *item);
                 if (!result) {
+                    item->_status = SyncFileItem::Status::NormalError;
                     item->_instruction = CSYNC_INSTRUCTION_ERROR;
                     item->_errorString = tr("Could not update file: %1").arg(result.error());
+                    emit itemCompleted(item);
                     return;
                 }
             }
@@ -363,8 +365,10 @@ void OCC::SyncEngine::slotItemDiscovered(const OCC::SyncFileItemPtr &item)
             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);
                     return;
                 }
             }