Commit d322d9b8 authored by Vincent Petry's avatar Vincent Petry Committed by GitHub
Browse files

Merge pull request #26411 from owncloud/userssetup-check-order

[master] Fix initMountPoints to set usersSetup earlier
parents 6c8534fd ae568529
......@@ -394,26 +394,36 @@ class Filesystem {
throw new \OC\User\NoUserException('Attempted to initialize mount points for null user and no user in session');
}
if (isset(self::$usersSetup[$user])) {
return;
}
self::$usersSetup[$user] = true;
$userManager = \OC::$server->getUserManager();
$userObject = $userManager->get($user);
if (is_null($userObject)) {
\OCP\Util::writeLog('files', ' Backends provided no user object for ' . $user, \OCP\Util::ERROR);
// reset flag, this will make it possible to rethrow the exception if called again
unset(self::$usersSetup[$user]);
throw new \OC\User\NoUserException('Backends provided no user object for ' . $user);
}
$realUid = $userObject->getUID();
// workaround in case of different casings
if ($user !== $userObject->getUID()) {
if ($user !== $realUid) {
$stack = json_encode(debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS, 50));
\OCP\Util::writeLog('files', 'initMountPoints() called with wrong user casing. This could be a bug. Expected: "' . $userObject->getUID() . '" got "' . $user . '". Stack: ' . $stack, \OCP\Util::WARN);
}
$user = $userObject->getUID();
\OCP\Util::writeLog('files', 'initMountPoints() called with wrong user casing. This could be a bug. Expected: "' . $realUid . '" got "' . $user . '". Stack: ' . $stack, \OCP\Util::WARN);
$user = $realUid;
if (isset(self::$usersSetup[$user])) {
return;
}
// again with the correct casing
if (isset(self::$usersSetup[$user])) {
return;
}
self::$usersSetup[$user] = true;
self::$usersSetup[$user] = true;
}
/** @var \OC\Files\Config\MountProviderCollection $mountConfigManager */
$mountConfigManager = \OC::$server->getMountProviderCollection();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment