From: Felix Weilbach Date: Tue, 23 Mar 2021 09:02:04 +0000 (+0100) Subject: Check reading from journal was successful before remove placeholder X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~21^2~303^2 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=d78774f29e9bb52efd057ecf7b97db20063fde94;p=nextcloud-desktop.git Check reading from journal was successful before remove placeholder Signed-off-by: Felix Weilbach --- diff --git a/src/libsync/vfs/cfapi/vfs_cfapi.cpp b/src/libsync/vfs/cfapi/vfs_cfapi.cpp index 925dacf35..580c15b99 100644 --- a/src/libsync/vfs/cfapi/vfs_cfapi.cpp +++ b/src/libsync/vfs/cfapi/vfs_cfapi.cpp @@ -363,16 +363,19 @@ void VfsCfApi::onHydrationJobFinished(HydrationJob *job) void VfsCfApi::onHydrationJobCanceled(HydrationJob *job) { - const auto folderPath = job->localPath(); const auto folderRelativePath = job->folderPath(); + SyncJournalFileRecord record; + if (!params().journal->getFileRecord(folderRelativePath, &record)) { + qCWarning(lcCfApi) << "Could not read file record from journal for canceled hydration request."; + return; + } // Remove placeholder file because there might be already pumped // some data into it + const auto folderPath = job->localPath(); QFile::remove(folderPath + folderRelativePath); // Create a new placeholder file - SyncJournalFileRecord record; - params().journal->getFileRecord(folderRelativePath, &record); const auto item = SyncFileItem::fromSyncJournalFileRecord(record); createPlaceholder(*item); }