diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-05-22 16:42:52 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-05-22 16:42:52 +0200 |
commit | ce34edacfa8fbc4f7340b4eb1ad65b35791a95e5 (patch) | |
tree | e51e560aa4b255fd684f845fd3187aaf75db4b0e /tests | |
parent | b82d902e184960877110bc45124ed2399f779cac (diff) | |
parent | fef75e5417206fcc36d979022f0f9921a743a3ae (diff) | |
download | nextcloud-server-ce34edacfa8fbc4f7340b4eb1ad65b35791a95e5.tar.gz nextcloud-server-ce34edacfa8fbc4f7340b4eb1ad65b35791a95e5.zip |
Merge pull request #16526 from owncloud/enc_fix_versions_webdav_upload
remove part file extension before we read a filekey
Diffstat (limited to 'tests')
-rw-r--r-- | tests/lib/encryption/keys/storage.php | 4 | ||||
-rw-r--r-- | tests/lib/encryption/utiltest.php | 20 |
2 files changed, 23 insertions, 1 deletions
diff --git a/tests/lib/encryption/keys/storage.php b/tests/lib/encryption/keys/storage.php index e67103fb6aa..fa623ac1c1b 100644 --- a/tests/lib/encryption/keys/storage.php +++ b/tests/lib/encryption/keys/storage.php @@ -76,7 +76,9 @@ class StorageTest extends TestCase { $this->util->expects($this->any()) ->method('getUidAndFilename') ->willReturn(array('user1', '/files/foo.txt')); - $this->util->expects($this->any()) + // we need to strip away the part file extension in order to reuse a + // existing key if it exists, otherwise versions will break + $this->util->expects($this->once()) ->method('stripPartialFileExtension') ->willReturnArgument(0); $this->util->expects($this->any()) diff --git a/tests/lib/encryption/utiltest.php b/tests/lib/encryption/utiltest.php index 0154fa30f7d..d3a4e211daa 100644 --- a/tests/lib/encryption/utiltest.php +++ b/tests/lib/encryption/utiltest.php @@ -174,4 +174,24 @@ class UtilTest extends TestCase { ); } + /** + * @dataProvider dataTestStripPartialFileExtension + * + * @param string $path + * @param string $expected + */ + public function testStripPartialFileExtension($path, $expected) { + $this->assertSame($expected, + $this->util->stripPartialFileExtension($path)); + } + + public function dataTestStripPartialFileExtension() { + return array( + array('/foo/test.txt', '/foo/test.txt'), + array('/foo/test.txt.part', '/foo/test.txt'), + array('/foo/test.txt.ocTransferId7567846853.part', '/foo/test.txt'), + array('/foo/test.txt.ocTransferId7567.part', '/foo/test.txt'), + ); + } + } |