[Pkg-owncloud-commits] [owncloud-client] 72/470: Checksums: keep the transfer checksum in the database as the content checksum

Sandro Knauß hefee-guest at moszumanska.debian.org
Thu May 12 16:24:46 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 e6f81d39657f61078d8c42314d54b9d9bca5d036
Author: Olivier Goffart <ogoffart at woboq.com>
Date:   Thu Feb 25 17:17:14 2016 +0100

    Checksums: keep the transfer checksum in the database as the content checksum
    
    Currently, we only use this for .eml files. But we can just store this checksum
    in the database if it was computed anyway.
    
    Issue #4487
---
 src/libsync/propagatedownload.cpp | 9 +++++++--
 src/libsync/propagatedownload.h   | 3 ++-
 src/libsync/propagateupload.cpp   | 6 ++++++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/src/libsync/propagatedownload.cpp b/src/libsync/propagatedownload.cpp
index dfc2795..c599ea1 100644
--- a/src/libsync/propagatedownload.cpp
+++ b/src/libsync/propagatedownload.cpp
@@ -550,7 +550,7 @@ void PropagateDownloadFileQNAM::slotGetFinished()
     // as this is (still) also correct.
     ValidateChecksumHeader *validator = new ValidateChecksumHeader(this);
     connect(validator, SIGNAL(validated(QByteArray,QByteArray)),
-            SLOT(downloadFinished()));
+            SLOT(downloadFinished(QByteArray,QByteArray)));
     connect(validator, SIGNAL(validationFailed(QString)),
             SLOT(slotChecksumFail(QString)));
     auto checksumHeader = job->reply()->rawHeader(checkSumHeaderC);
@@ -638,8 +638,13 @@ static void handleRecallFile(const QString &fn)
 }
 } // end namespace
 
-void PropagateDownloadFileQNAM::downloadFinished()
+void PropagateDownloadFileQNAM::downloadFinished(const QByteArray& transportChecksumType,
+                                                 const QByteArray& transportChecksum)
 {
+    // by default, reuse the transport checksum as content checksum
+    _item->_contentChecksum = transportChecksum;
+    _item->_contentChecksumType = transportChecksumType;
+
     QString fn = _propagator->getFilePath(_item->_file);
 
     // In case of file name clash, report an error
diff --git a/src/libsync/propagatedownload.h b/src/libsync/propagatedownload.h
index 8ba11f1..ba70d2a 100644
--- a/src/libsync/propagatedownload.h
+++ b/src/libsync/propagatedownload.h
@@ -128,7 +128,8 @@ public:
 private slots:
     void slotGetFinished();
     void abort() Q_DECL_OVERRIDE;
-    void downloadFinished();
+    void downloadFinished(const QByteArray& transportChecksumType = QByteArray(),
+                          const QByteArray &transportChecksum = QByteArray());
     void slotDownloadProgress(qint64,qint64);
     void slotChecksumFail( const QString& errMsg );
 
diff --git a/src/libsync/propagateupload.cpp b/src/libsync/propagateupload.cpp
index 92439b6..1d76434 100644
--- a/src/libsync/propagateupload.cpp
+++ b/src/libsync/propagateupload.cpp
@@ -282,6 +282,12 @@ void PropagateUploadFileQNAM::slotStartUpload(const QByteArray& transmissionChec
     _transmissionChecksum = transmissionChecksum;
     _transmissionChecksumType = transmissionChecksumType;
 
+    if (_item->_contentChecksum.isEmpty() && _item->_contentChecksumType.isEmpty())  {
+        // If the _contentChecksum was not set, reuse the transmission checksum as the content checksum.
+        _item->_contentChecksum = transmissionChecksum;
+        _item->_contentChecksumType = transmissionChecksumType;
+    }
+
     const QString fullFilePath = _propagator->getFilePath(_item->_file);
 
     if (!FileSystem::fileExists(fullFilePath)) {

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