Merge pull request #24187 from owncloud/fs-initmountpoint-rethrowifusernotfoundagain

Mark $usersSetup only if user was found in initMountPoints
This commit is contained in:
Thomas Müller 2016-04-22 17:25:40 +02:00
commit 8c7c713e86
2 changed files with 24 additions and 2 deletions

View File

@ -378,8 +378,6 @@ class Filesystem {
if (isset(self::$usersSetup[$user])) {
return;
}
self::$usersSetup[$user] = true;
$root = \OC_User::getHome($user);
$userManager = \OC::$server->getUserManager();
@ -390,6 +388,8 @@ class Filesystem {
throw new \OC\User\NoUserException('Backends provided no user object for ' . $user);
}
self::$usersSetup[$user] = true;
$homeStorage = \OC::$server->getConfig()->getSystemValue('objectstore');
if (!empty($homeStorage)) {
// sanity checks

View File

@ -341,6 +341,28 @@ class Filesystem extends \Test\TestCase {
$this->assertEquals(2, $thrown);
}
/**
* Tests that an exception is thrown when passed user does not exist.
*/
public function testLocalMountWhenUserDoesNotExistTwice() {
$thrown = 0;
$userId = $this->getUniqueID('user_');
try {
\OC\Files\Filesystem::initMountPoints($userId);
} catch (NoUserException $e) {
$thrown++;
}
try {
\OC\Files\Filesystem::initMountPoints($userId);
} catch (NoUserException $e) {
$thrown++;
}
$this->assertEquals(2, $thrown);
}
/**
* Tests that the home storage is used for the user's mount point
*/