summaryrefslogtreecommitdiffstats
path: root/apps
diff options
context:
space:
mode:
authorMarkus Goetz <markus@woboq.com>2016-07-12 18:00:10 +0200
committerThomas Müller <DeepDiver1975@users.noreply.github.com>2016-07-12 18:00:10 +0200
commit971a4b5d4cb42c11de1f09538006ed25b6393a8a (patch)
tree756aa32d547db6050c8f6398bc740221b4945225 /apps
parente00fe47b9fb8e7f804c0be595c87490f4955f1f2 (diff)
downloadnextcloud-server-971a4b5d4cb42c11de1f09538006ed25b6393a8a.tar.gz
nextcloud-server-971a4b5d4cb42c11de1f09538006ed25b6393a8a.zip
Locking: Limit key length in Shared Storage #25376 (#25423)
Diffstat (limited to 'apps')
-rw-r--r--apps/files_sharing/tests/sharedstorage.php27
1 files changed, 27 insertions, 0 deletions
diff --git a/apps/files_sharing/tests/sharedstorage.php b/apps/files_sharing/tests/sharedstorage.php
index 3361d2cbd12..6418d00ac1d 100644
--- a/apps/files_sharing/tests/sharedstorage.php
+++ b/apps/files_sharing/tests/sharedstorage.php
@@ -6,6 +6,7 @@
* @author Robin Appelman <icewind@owncloud.com>
* @author Thomas Müller <thomas.mueller@tmit.eu>
* @author Vincent Petry <pvince81@owncloud.com>
+ * @author Markus Goetz <markus@woboq.com>
*
* @copyright Copyright (c) 2015, ownCloud, Inc.
* @license AGPL-3.0
@@ -483,4 +484,30 @@ class Test_Files_Sharing_Storage extends OCA\Files_sharing\Tests\TestCase {
$source = $storage->getFile('');
$this->assertEquals(self::TEST_FILES_SHARING_API_USER1, $source['uid_owner']);
}
+
+ public function testLongLock() {
+ // https://github.com/owncloud/core/issues/25376
+ $fn = str_repeat("x",250); // maximum name length in oc_filecache
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER1);
+ $view1 = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER1 . '/files');
+ $view1->mkdir($fn);
+ $view1->mkdir($fn.'/'.'vincent');
+ $view1->file_put_contents($fn . '/vincent/' . $fn, "dummy file data\n");
+
+ $fileinfo = $view1->getFileInfo($fn);
+ $result = \OCP\Share::shareItem('folder', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2, \OCP\Constants::PERMISSION_ALL);
+ $this->assertTrue($result);
+
+ self::loginHelper(self::TEST_FILES_SHARING_API_USER2);
+ $user2View = new \OC\Files\View('/' . self::TEST_FILES_SHARING_API_USER2 . '/files');
+ $this->assertTrue($user2View->file_exists($fn . '/vincent/' . $fn));
+
+ list($sharedStorage,$bla) = $user2View->resolvePath($fn . '/vincent/' . $fn);
+ $cache = $sharedStorage->getCache();
+ $scanner = $sharedStorage->getScanner();
+ $scanner->scan('');
+ $this->assertTrue($cache->inCache('/vincent'));
+ $this->assertTrue($cache->inCache('/vincent/'.$fn));
+ $this->assertEquals(16, $cache->get('/vincent/'.$fn)['size']);
+ }
}