From: Matthieu Gallien Date: Tue, 7 Dec 2021 10:33:43 +0000 (+0100) Subject: avoid downloading a file from server when modified time is invalid X-Git-Tag: archive/raspbian/3.16.7-1_deb13u1+rpi1~1^2~12^2~17^2~253^2~5 X-Git-Url: https://dgit.raspbian.org/?a=commitdiff_plain;h=389424c54b9f46c44dca4e736c3d0e3aa0f3b522;p=nextcloud-desktop.git avoid downloading a file from server when modified time is invalid Signed-off-by: Matthieu Gallien --- diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp index 7b17c364c..b06a4d115 100644 --- a/src/libsync/propagatedownload.cpp +++ b/src/libsync/propagatedownload.cpp @@ -1063,11 +1063,19 @@ void PropagateDownloadFile::downloadFinished() return; } + if (_item->_modtime <= 0) { + done(SyncFileItem::NormalError, tr("File %1 has invalid modified time reported by server. Do not save it.").arg(QDir::toNativeSeparators(_item->_file))); + return; + } Q_ASSERT(_item->_modtime > 0); FileSystem::setModTime(_tmpFile.fileName(), _item->_modtime); // We need to fetch the time again because some file systems such as FAT have worse than a second // Accuracy, and we really need the time from the file system. (#3103) _item->_modtime = FileSystem::getModTime(_tmpFile.fileName()); + if (_item->_modtime <= 0) { + done(SyncFileItem::NormalError, tr("File %1 has invalid modified time reported by server. Do not save it.").arg(QDir::toNativeSeparators(_item->_file))); + return; + } Q_ASSERT(_item->_modtime > 0); bool previousFileExists = FileSystem::fileExists(fn);