From f69a21a77adce2e13a6b40ee550bce5d12b41b9a Mon Sep 17 00:00:00 2001 From: Piotr Mrowczynski Date: Tue, 14 Aug 2018 18:46:12 +0200 Subject: [PATCH] [objectstore] Fix checksums not being updated on modifying shared file --- apps/dav/lib/Connector/Sabre/File.php | 10 ++++++++++ .../features/apiMain/checksums.feature | 17 +++++++++++++++++ 2 files changed, 27 insertions(+) diff --git a/apps/dav/lib/Connector/Sabre/File.php b/apps/dav/lib/Connector/Sabre/File.php index 94cee09903bb..6f155aee3366 100644 --- a/apps/dav/lib/Connector/Sabre/File.php +++ b/apps/dav/lib/Connector/Sabre/File.php @@ -272,6 +272,16 @@ public function put($data) { } $this->refreshInfo(); +// $meta = $partStorage->getMetaData($internalPartPath); +// +// if (isset($meta['checksum'])) { +// $this->fileView->putFileInfo( +// $this->path, +// ['checksum' => $meta['checksum']] +// ); +// } +// +// $this->refreshInfo(); } catch (StorageNotAvailableException $e) { throw new ServiceUnavailable("Failed to check file size: " . $e->getMessage()); } diff --git a/tests/acceptance/features/apiMain/checksums.feature b/tests/acceptance/features/apiMain/checksums.feature index cfbd13f65c43..5fa242af7d11 100644 --- a/tests/acceptance/features/apiMain/checksums.feature +++ b/tests/acceptance/features/apiMain/checksums.feature @@ -100,6 +100,23 @@ Feature: checksums And user "user0" requests the checksum of "/myChecksumFileCopy.txt" via propfind Then the webdav checksum should match "SHA1:3ee962b839762adb0ad8ba6023a4690be478de6f MD5:d70b40f177b14b470d1756a3c12b963a ADLER32:8ae90960" + Scenario: Sharing a file with checksum should return the checksum in the propfind using new DAV path + Given using new DAV path + And user "user1" has been created + And user "user0" has uploaded file "data/textfile.txt" to "/myChecksumFile.txt" with checksum "MD5:d70b40f177b14b470d1756a3c12b963a" + When user "user0" shares file "/myChecksumFile.txt" with user "user1" using the sharing API + And user "user1" requests the checksum of "/myChecksumFile.txt" via propfind + Then the webdav checksum should match "SHA1:3ee962b839762adb0ad8ba6023a4690be478de6f MD5:d70b40f177b14b470d1756a3c12b963a ADLER32:8ae90960" + + Scenario: Sharing and modifying a file should return correct checksum in the propfind using new DAV path + Given using new DAV path + And user "user1" has been created + And user "user0" has uploaded file "data/textfile.txt" to "/myChecksumFile.txt" with checksum "MD5:d70b40f177b14b470d1756a3c12b963a" + When user "user0" shares file "/myChecksumFile.txt" with user "user1" using the sharing API + And user "user1" uploads file with checksum "SHA1:ce5582148c6f0c1282335b87df5ed4be4b781399" and content "Some Text" to "/myChecksumFile.txt" using the WebDAV API + And user "user0" requests the checksum of "/myChecksumFile.txt" via propfind + Then the webdav checksum should match "SHA1:ce5582148c6f0c1282335b87df5ed4be4b781399 MD5:56e57920c3c8c727bfe7a5288cdf61c4 ADLER32:1048035a" + Scenario: Copying file with checksum should return the checksum in the download header using new DAV path Given using new DAV path And user "user0" has uploaded file "data/textfile.txt" to "/myChecksumFile.txt" with checksum "MD5:d70b40f177b14b470d1756a3c12b963a"