From: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com> Date: Thu, 9 Jul 2020 19:23:24 +0000 (+0200) Subject: Prevent empty FileMap in local csync to be processed if folder not empty X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~222^2^2~79^2~2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d47e570ff3562b9d5d5e9178269b297775626746;p=nextcloud-desktop.git Prevent empty FileMap in local csync to be processed if folder not empty Signed-off-by: Dominique Fuchs <32204802+DominiqueFuchs@users.noreply.github.com> --- diff --git a/src/libsync/syncengine.cpp b/src/libsync/syncengine.cpp index cd20bf4be..942cae607 100644 --- a/src/libsync/syncengine.cpp +++ b/src/libsync/syncengine.cpp @@ -1040,6 +1040,17 @@ void SyncEngine::slotDiscoveryJobFinished(int discoveryResult) _journal->commitIfNeededAndStartNewTransaction("Post discovery"); } + // FIXME: This is a reasonable safety check, but specifically just a hotfix. + // See: https://github.com/nextcloud/desktop/issues/1433 + // It's still unclear why we can get an empty FileMap even though folder isn't empty + // For now: Re-check if folder is really empty, if not bail out + auto test = QDir(_localPath).entryInfoList(); + if (_csync_ctx.data()->local.files.empty() && QDir(_localPath).entryInfoList(QDir::NoDotAndDotDot).count() > 0) { + qCWarning(lcEngine) << "Received local tree with empty FileMap but sync folder isn't empty. Won't reconcile."; + finalize(false); + return; + } + _progressInfo->_currentDiscoveredRemoteFolder.clear(); _progressInfo->_currentDiscoveredLocalFolder.clear(); _progressInfo->_status = ProgressInfo::Reconcile;