Skip to content

Commit

Permalink
Store avatars outside of the home
Browse files Browse the repository at this point in the history
Inside a hidden ".avatars" folder.
Doesn't require home FS setup
  • Loading branch information
Vincent Petry committed Aug 19, 2016
1 parent c058e94 commit c54e5c6
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions lib/private/AvatarManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,17 @@ public function getAvatar($userId) {
throw new \Exception('user does not exist');
}

/*
* 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);
$avatarsFolder = $this->getFolder($this->rootFolder, '.avatars');
$usersAvatarsFolder = $this->getFolder($avatarsFolder, $userId);

return new Avatar($folder, $this->l, $user, $this->logger);
return new Avatar($usersAvatarsFolder, $this->l, $user, $this->logger);
}

private function getFolder(Folder $folder, $path) {
try {
return $folder->get($path);
} catch (NotFoundException $e) {
return $folder->newFolder($path);
}
}
}

0 comments on commit c54e5c6

Please sign in to comment.