diff options
author | Vincent Petry <pvince81@owncloud.com> | 2015-04-13 12:36:47 +0200 |
---|---|---|
committer | Vincent Petry <pvince81@owncloud.com> | 2015-04-13 12:48:09 +0200 |
commit | 105b2858740dc2ece26fe6a010070aac2ccb21d9 (patch) | |
tree | 6c4f06baee267bec4e2ac0595f65c46cf00a631d | |
parent | 06ab387509e81fb33a5cef30ee038a9019c4b128 (diff) | |
download | nextcloud-server-105b2858740dc2ece26fe6a010070aac2ccb21d9.tar.gz nextcloud-server-105b2858740dc2ece26fe6a010070aac2ccb21d9.zip |
Properly add trailing slash to mount point
Fixes resolving mount points when shared mount point's target name has
the same prefix as the source name
-rw-r--r-- | apps/files_sharing/tests/sharedmount.php | 12 | ||||
-rw-r--r-- | lib/private/files/mount/mountpoint.php | 4 | ||||
-rw-r--r-- | tests/lib/files/mount/mountpoint.php | 4 |
3 files changed, 16 insertions, 4 deletions
diff --git a/apps/files_sharing/tests/sharedmount.php b/apps/files_sharing/tests/sharedmount.php index 715c22cf4ae..33fee2bd03e 100644 --- a/apps/files_sharing/tests/sharedmount.php +++ b/apps/files_sharing/tests/sharedmount.php @@ -141,14 +141,20 @@ class Test_Files_Sharing_Mount extends OCA\Files_sharing\Tests\TestCase { self::loginHelper(self::TEST_FILES_SHARING_API_USER2); - \OC\Files\Filesystem::rename($this->filename, "newFileName"); + \OC\Files\Filesystem::rename($this->filename, $this->filename . '_renamed'); - $this->assertTrue(\OC\Files\Filesystem::file_exists('newFileName')); + $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename . '_renamed')); $this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename)); self::loginHelper(self::TEST_FILES_SHARING_API_USER1); $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename)); - $this->assertFalse(\OC\Files\Filesystem::file_exists("newFileName")); + $this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename . '_renamed')); + + // rename back to original name + self::loginHelper(self::TEST_FILES_SHARING_API_USER2); + \OC\Files\Filesystem::rename($this->filename . '_renamed', $this->filename); + $this->assertFalse(\OC\Files\Filesystem::file_exists($this->filename . '_renamed')); + $this->assertTrue(\OC\Files\Filesystem::file_exists($this->filename)); //cleanup \OCP\Share::unshare('file', $fileinfo['fileid'], \OCP\Share::SHARE_TYPE_USER, self::TEST_FILES_SHARING_API_USER2); diff --git a/lib/private/files/mount/mountpoint.php b/lib/private/files/mount/mountpoint.php index 85edb7cb570..b62dc478015 100644 --- a/lib/private/files/mount/mountpoint.php +++ b/lib/private/files/mount/mountpoint.php @@ -95,10 +95,12 @@ class MountPoint implements IMountPoint { } /** + * Sets the mount point path, relative to data/ + * * @param string $mountPoint new mount point */ public function setMountPoint($mountPoint) { - $this->mountPoint = $mountPoint; + $this->mountPoint = $this->formatPath($mountPoint); } /** diff --git a/tests/lib/files/mount/mountpoint.php b/tests/lib/files/mount/mountpoint.php index 5a9c6de3e0a..29610e6058d 100644 --- a/tests/lib/files/mount/mountpoint.php +++ b/tests/lib/files/mount/mountpoint.php @@ -31,6 +31,10 @@ class MountPoint extends \Test\TestCase { $this->assertEquals($storage, $mountPoint->getStorage()); $this->assertEquals(123, $mountPoint->getStorageId()); + $this->assertEquals('/mountpoint/', $mountPoint->getMountPoint()); + + $mountPoint->setMountPoint('another'); + $this->assertEquals('/another/', $mountPoint->getMountPoint()); } public function testInvalidStorage() { |