remove files which gets downloaded with an invalid modified time
authorMatthieu Gallien <matthieu.gallien@nextcloud.com>
Wed, 8 Dec 2021 17:33:56 +0000 (18:33 +0100)
committerMatthieu Gallien <matthieu.gallien@nextcloud.com>
Thu, 9 Dec 2021 09:00:36 +0000 (10:00 +0100)
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
src/libsync/propagatedownload.cpp

index 443ebfdaca15625d4fa04e4ce4f8b72aff4003eb..c7f8ff5bf3198181295bdf12abb4a3b0ffb1c6ab 100644 (file)
@@ -1076,6 +1076,7 @@ void PropagateDownloadFile::downloadFinished()
     }
 
     if (_item->_modtime <= 0) {
+        FileSystem::remove(_tmpFile.fileName());
         done(SyncFileItem::NormalError, tr("File %1 has invalid modified time reported by server. Do not save it.").arg(QDir::toNativeSeparators(_item->_file)));
         return;
     }
@@ -1088,6 +1089,7 @@ void PropagateDownloadFile::downloadFinished()
     // Accuracy, and we really need the time from the file system. (#3103)
     _item->_modtime = FileSystem::getModTime(_tmpFile.fileName());
     if (_item->_modtime <= 0) {
+        FileSystem::remove(_tmpFile.fileName());
         done(SyncFileItem::NormalError, tr("File %1 has invalid modified time reported by server. Do not save it.").arg(QDir::toNativeSeparators(_item->_file)));
         return;
     }