diff options
author | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-15 20:49:07 +0100 |
---|---|---|
committer | Roeland Jago Douma <rullzer@owncloud.com> | 2016-02-16 09:18:38 +0100 |
commit | 47d28155a8c07a208bf30f16a03efc2843dec408 (patch) | |
tree | fdf14bcc7d2db6f7a4a7efa873fba7a91645ac34 /lib/private/avatarmanager.php | |
parent | 907430a80812bbf5378a4c5d10de6ab7ddf6f8e4 (diff) | |
download | nextcloud-server-47d28155a8c07a208bf30f16a03efc2843dec408.tar.gz nextcloud-server-47d28155a8c07a208bf30f16a03efc2843dec408.zip |
Do not copy skeleton on avatar access
Fixes #22119
Just try to get the folder of the user. If it is not there a
NotFoundException will be thrown. Which will be handled by the avatar
endpoint.
Diffstat (limited to 'lib/private/avatarmanager.php')
-rw-r--r-- | lib/private/avatarmanager.php | 22 |
1 files changed, 20 insertions, 2 deletions
diff --git a/lib/private/avatarmanager.php b/lib/private/avatarmanager.php index b39f5495122..21f88b1fd3f 100644 --- a/lib/private/avatarmanager.php +++ b/lib/private/avatarmanager.php @@ -26,6 +26,7 @@ namespace OC; +use OCP\Files\Folder; use OCP\IAvatarManager; use OCP\IUserManager; use OCP\Files\IRootFolder; @@ -45,6 +46,13 @@ class AvatarManager implements IAvatarManager { /** @var IL10N */ private $l; + /** + * AvatarManager constructor. + * + * @param IUserManager $userManager + * @param IRootFolder $rootFolder + * @param IL10N $l + */ public function __construct( IUserManager $userManager, IRootFolder $rootFolder, @@ -57,7 +65,7 @@ class AvatarManager implements IAvatarManager { /** * return a user specific instance of \OCP\IAvatar * @see \OCP\IAvatar - * @param string $user the ownCloud user id + * @param string $userId the ownCloud user id * @return \OCP\IAvatar * @throws \Exception In case the username is potentially dangerous */ @@ -66,6 +74,16 @@ class AvatarManager implements IAvatarManager { if (is_null($user)) { throw new \Exception('user does not exist'); } - return new Avatar($this->rootFolder->getUserFolder($userId)->getParent(), $this->l, $user); + + /* + * Fix for #22119 + * Basically we do not want to copy the skeleton folder + */ + \OC\Files\Filesystem::initMountPoints($userId); + $dir = '/' . $userId; + /** @var Folder $folder */ + $folder = $this->rootFolder->get($dir); + + return new Avatar($folder, $this->l, $user); } } |