From ec140fa2ec2aaf489bae728971ec18e58719a38a Mon Sep 17 00:00:00 2001
From: Roeland Jago Douma <rullzer@owncloud.com>
Date: Sun, 28 Feb 2016 20:21:43 +0100
Subject: [PATCH] Checksums on chunked files

We should also store checksums on chunked files.
We do not checksum individual chunks but only the final file.
---
 apps/dav/lib/connector/sabre/file.php | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/apps/dav/lib/connector/sabre/file.php b/apps/dav/lib/connector/sabre/file.php
index b7e2108db3..b71c4ccc62 100644
--- a/apps/dav/lib/connector/sabre/file.php
+++ b/apps/dav/lib/connector/sabre/file.php
@@ -457,6 +457,14 @@ class File extends Node implements IFile {
 
 				$this->fileView->changeLock($targetPath, ILockingProvider::LOCK_SHARED);
 
+				if (isset($request->server['HTTP_OC_CHECKSUM'])) {
+					$checksum = trim($request->server['HTTP_OC_CHECKSUM']);
+					$this->fileView->putFileInfo($targetPath, ['checksum' => $checksum]);
+				} else if ($this->getChecksum() !== NULL && $this->getChecksum() !== '') {
+					$this->fileView->putFileInfo($this->path, ['checksum' => '']);
+				}
+				$this->refreshInfo();
+
 				$this->emitPostHooks($exists, $targetPath);
 
 				$info = $this->fileView->getFileInfo($targetPath);
-- 
GitLab