From 2a3059d779a2b656b61615db775f6022304137fc Mon Sep 17 00:00:00 2001 From: Matthieu Gallien Date: Sun, 3 Apr 2022 16:12:42 +0200 Subject: [PATCH] ensure we do properly failed hydration jobs report status when the job is in error at end of hydration request instead of doing the opposite properly set status in db when a file failed to hydrate (still a virtual file not a real one) Signed-off-by: Matthieu Gallien --- src/libsync/vfs/cfapi/cfapiwrapper.cpp | 2 +- src/libsync/vfs/cfapi/hydrationjob.cpp | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/libsync/vfs/cfapi/cfapiwrapper.cpp b/src/libsync/vfs/cfapi/cfapiwrapper.cpp index 8fa3aeb9a..089a84964 100644 --- a/src/libsync/vfs/cfapi/cfapiwrapper.cpp +++ b/src/libsync/vfs/cfapi/cfapiwrapper.cpp @@ -229,7 +229,7 @@ void CALLBACK cfApiFetchDataCallback(const CF_CALLBACK_INFO *callbackInfo, const qCritical(lcCfApiWrapper) << "Failed to finalize hydration job for" << path << requestId; } - if (static_cast(hydrationJobResult) == OCC::HydrationJob::Success) { + if (static_cast(hydrationJobResult) != OCC::HydrationJob::Success) { sendTransferError(); } } diff --git a/src/libsync/vfs/cfapi/hydrationjob.cpp b/src/libsync/vfs/cfapi/hydrationjob.cpp index 12570ebe9..2c93ec2df 100644 --- a/src/libsync/vfs/cfapi/hydrationjob.cpp +++ b/src/libsync/vfs/cfapi/hydrationjob.cpp @@ -300,7 +300,16 @@ void OCC::HydrationJob::finalize(OCC::VfsCfApi *vfs) return; } - record._type = ItemTypeFile; + switch(_status) { + case Success: + record._type = ItemTypeFile; + break; + case Error: + case Cancelled: + record._type = CSyncEnums::ItemTypeVirtualFile; + break; + }; + // store the actual size of a file that has been decrypted as we will need its actual size when dehydrating it if requested record._fileSize = FileSystem::getSize(localPath() + folderPath()); -- 2.30.2