diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-28 19:41:46 +0100 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2016-03-01 11:37:16 +0100 |
commit | 3e88a5067f3ef6fd81068f85a00ee2a49a8f9b79 (patch) | |
tree | bf48f085f57e3c6c2dbd8b10578d1a19c11e91e6 | |
parent | 03d0fa012f967dd058d3926751dc147537760ce3 (diff) | |
download | nextcloud-server-3e88a5067f3ef6fd81068f85a00ee2a49a8f9b79.tar.gz nextcloud-server-3e88a5067f3ef6fd81068f85a00ee2a49a8f9b79.zip |
Remove checksum on upload of non checksumed file
When we overwrite a checksumed file with a file without a checksum we
should remove the checksum from the server.
This is done by setting the column to empty.
-rw-r--r-- | apps/dav/lib/connector/sabre/file.php | 2 | ||||
-rw-r--r-- | apps/dav/lib/connector/sabre/filesplugin.php | 7 |
2 files changed, 8 insertions, 1 deletions
diff --git a/apps/dav/lib/connector/sabre/file.php b/apps/dav/lib/connector/sabre/file.php index 38a1ee5f4e2..b7e2108db3b 100644 --- a/apps/dav/lib/connector/sabre/file.php +++ b/apps/dav/lib/connector/sabre/file.php @@ -218,6 +218,8 @@ class File extends Node implements IFile { if (isset($request->server['HTTP_OC_CHECKSUM'])) { $checksum = trim($request->server['HTTP_OC_CHECKSUM']); $this->fileView->putFileInfo($this->path, ['checksum' => $checksum]); + } else if ($this->getChecksum() !== NULL && $this->getChecksum() !== '') { + $this->fileView->putFileInfo($this->path, ['checksum' => '']); } $this->refreshInfo(); diff --git a/apps/dav/lib/connector/sabre/filesplugin.php b/apps/dav/lib/connector/sabre/filesplugin.php index eb9116d219b..4b05922adfd 100644 --- a/apps/dav/lib/connector/sabre/filesplugin.php +++ b/apps/dav/lib/connector/sabre/filesplugin.php @@ -27,6 +27,7 @@ namespace OCA\DAV\Connector\Sabre; +use Sabre\DAV\Exception\NotFound; use Sabre\DAV\IFile; use \Sabre\DAV\PropFind; use \Sabre\DAV\PropPatch; @@ -197,7 +198,7 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin { //Add OC-Checksum header /** @var $node File */ $checksum = $node->getChecksum(); - if ($checksum !== null) { + if ($checksum !== null && $checksum !== '') { $response->addHeader('OC-Checksum', $checksum); } } @@ -252,6 +253,10 @@ class FilesPlugin extends \Sabre\DAV\ServerPlugin { $propFind->handle(self::CHECKSUMS_PROPERTYNAME, function() use ($node) { $checksum = $node->getChecksum(); + if ($checksum === NULL || $checksum === '') { + return null; + } + return new ChecksumList($checksum); }); |