diff options
author | Matthieu Gallien <matthieu.gallien@nextcloud.com> | 2021-12-07 13:33:43 +0300 |
---|---|---|
committer | Matthieu Gallien (Rebase PR Action) <matthieu_gallien@yahoo.fr> | 2021-12-08 10:22:24 +0300 |
commit | 389424c54b9f46c44dca4e736c3d0e3aa0f3b522 (patch) | |
tree | 8313ff869447720f564b3494c2ac015db85e1c94 /src/libsync | |
parent | c9f63b5744ac598c701b0516db8686a6609bea14 (diff) |
avoid downloading a file from server when modified time is invalid
Signed-off-by: Matthieu Gallien <matthieu.gallien@nextcloud.com>
Diffstat (limited to 'src/libsync')
-rw-r--r-- | src/libsync/propagatedownload.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
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); |