[Pkg-owncloud-commits] [owncloud-client] 427/470: PropagateDownload: Throw an error if the file is empty while it should not have been (#4753)
Sandro Knauß
hefee-guest at moszumanska.debian.org
Thu May 12 16:25:37 UTC 2016
This is an automated email from the git hooks/post-receive script.
hefee-guest pushed a commit to branch master
in repository owncloud-client.
commit 11b144957b0e502f678e28bcf5feec848a7e1316
Author: Olivier Goffart <olivier at woboq.com>
Date: Fri Apr 29 08:49:27 2016 +0200
PropagateDownload: Throw an error if the file is empty while it should not have been (#4753)
If the downloaded file is empty but the PROPFIND previously announced it
should not have been empty, this might mean the file was somehow corrupted
because of a bug on the server and that we should therefore not accept
the file.
Normaly we accept a change between the actual size of the file and what we
got during discovery because the file might have been updated to a new version
inbetween. But after this patch we won't accept the file if it was replaced
by an empty file.
Will help for issue #4583
Also requested by IL for issue 548
---
src/libsync/propagatedownload.cpp | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp
index 2b6e014..0dd9205 100644
--- a/src/libsync/propagatedownload.cpp
+++ b/src/libsync/propagatedownload.cpp
@@ -543,6 +543,14 @@ void PropagateDownloadFileQNAM::slotGetFinished()
return;
}
+ if (_tmpFile.size() == 0 && _item->_size > 0) {
+ FileSystem::remove(_tmpFile.fileName());
+ done(SyncFileItem::NormalError,
+ tr("The downloaded file is empty despite the server announced it should have been %1.")
+ .arg(Utility::octetsToString(_item->_size)));
+ return;
+ }
+
// Do checksum validation for the download. If there is no checksum header, the validator
// will also emit the validated() signal to continue the flow in slot downloadFinished()
// as this is (still) also correct.
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-owncloud/owncloud-client.git
More information about the Pkg-owncloud-commits
mailing list