Skip to content

Commit

Permalink
Check reading from journal was successful before remove placeholder
Browse files Browse the repository at this point in the history
Signed-off-by: Felix Weilbach <felix.weilbach@nextcloud.com>
  • Loading branch information
Felix Weilbach committed Mar 23, 2021
1 parent 4d921c8 commit e1ece7d
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/libsync/vfs/cfapi/vfs_cfapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit e1ece7d

Please sign in to comment.