diff options
Diffstat (limited to 'lib/private/avatarmanager.php')
-rw-r--r-- | lib/private/avatarmanager.php | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/private/avatarmanager.php b/lib/private/avatarmanager.php index b39f5495122..b2d3e6eb3dd 100644 --- a/lib/private/avatarmanager.php +++ b/lib/private/avatarmanager.php @@ -26,6 +26,8 @@ namespace OC; +use OCP\Files\Folder; +use OCP\Files\NotFoundException; use OCP\IAvatarManager; use OCP\IUserManager; use OCP\Files\IRootFolder; @@ -45,6 +47,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,15 +66,26 @@ 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 + * @throws NotFoundException In case there is no user folder yet */ public function getAvatar($userId) { $user = $this->userManager->get($userId); 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); } } |