vfs: Switch order of deletion and journal removal in dehydration
authorChristian Kamm <mail@ckamm.de>
Thu, 15 Nov 2018 09:26:48 +0000 (10:26 +0100)
committerKevin Ottens <kevin.ottens@nextcloud.com>
Tue, 15 Dec 2020 09:58:26 +0000 (10:58 +0100)
To be more crash-resilient.

src/libsync/propagatedownload.cpp

index a5d87effae23c39a95357af90306d2e5bfd6aad1..b4607a63b3205a26c775d36a64fa143e0c6a0780 100644 (file)
@@ -423,8 +423,8 @@ void PropagateDownloadFile::startAfterIsEncryptedIsChecked()
         // TODO: Could dehydrate without wiping the file entirely
         auto fn = propagator()->getFilePath(_item->_file);
         qCDebug(lcPropagateDownload) << "dehydration: wiping base file" << fn;
-        QFile::remove(fn);
         propagator()->_journal->deleteFileRecord(_item->_file);
+        QFile::remove(fn);
 
         if (vfs && vfs->mode() == Vfs::WithSuffix) {
             // Normally new suffix-virtual files already have the suffix included in the path