[Pkg-owncloud-commits] [owncloud-client] 143/470: Merge pull request #4532 from ckamm/content-checksum

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:24:55 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 25baa995ec75f88f050cc4924d0311762a75a836
Merge: 39a95d3 d6d3502
Author: ckamm <mail at ckamm.de>
Date:   Mon Mar 14 09:49:31 2016 +0100

    Merge pull request #4532 from ckamm/content-checksum
    
    Enable content checksums #4375

 src/libsync/checksums.cpp         |  9 +++++++++
 src/libsync/checksums.h           |  4 ++++
 src/libsync/propagatedownload.cpp | 39 ++++++++++++++++++++++++++++++++-------
 src/libsync/propagatedownload.h   |  5 +++--
 src/libsync/propagateupload.cpp   | 13 ++++---------
 5 files changed, 52 insertions(+), 18 deletions(-)

diff --cc src/libsync/propagatedownload.cpp
index 73f999c,fd3b6a7..dcffe26
--- a/src/libsync/propagatedownload.cpp
+++ b/src/libsync/propagatedownload.cpp
@@@ -637,25 -636,40 +637,50 @@@ static void handleRecallFile(const QStr
          FileSystem::uncheckedRenameReplace(fpath, rpath, &error);
      }
  }
 +
 +static void preserveGroupOwnership(const QString& fileName, const QFileInfo& fi)
 +{
 +#ifdef Q_OS_UNIX
 +    chown(fileName.toLocal8Bit().constData(), -1, fi.groupId());
 +#else
 +    Q_UNUSED(fileName);
 +    Q_UNUSED(fi);
 +#endif
 +}
  } // end namespace
  
- void PropagateDownloadFileQNAM::downloadFinished(const QByteArray& transportChecksumType,
-                                                  const QByteArray& transportChecksum)
+ 
+ void PropagateDownloadFileQNAM::transmissionChecksumValidated(const QByteArray &checksumType, const QByteArray &checksum)
  {
-     // by default, reuse the transport checksum as content checksum
-     _item->_contentChecksum = transportChecksum;
-     _item->_contentChecksumType = transportChecksumType;
+     const auto theContentChecksumType = contentChecksumType();
+ 
+     // Reuse transmission checksum as content checksum.
+     //
+     // We could do this more aggressively and accept both MD5 and SHA1
+     // instead of insisting on the exactly correct checksum type.
+     if (theContentChecksumType == checksumType || theContentChecksumType.isEmpty()) {
+         return contentChecksumComputed(checksumType, checksum);
+     }
+ 
+     // Compute the content checksum.
+     auto computeChecksum = new ComputeChecksum(this);
+     computeChecksum->setChecksumType(theContentChecksumType);
+ 
+     connect(computeChecksum, SIGNAL(done(QByteArray,QByteArray)),
+             SLOT(contentChecksumComputed(QByteArray,QByteArray)));
+     computeChecksum->start(_tmpFile.fileName());
+ }
  
+ void PropagateDownloadFileQNAM::contentChecksumComputed(const QByteArray &checksumType, const QByteArray &checksum)
+ {
+     _item->_contentChecksum = checksum;
+     _item->_contentChecksumType = checksumType;
+ 
+     downloadFinished();
+ }
+ 
+ void PropagateDownloadFileQNAM::downloadFinished()
+ {
      QString fn = _propagator->getFilePath(_item->_file);
  
      // In case of file name clash, report an error

-- 
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