diff options
author | Joas Schilling <coding@schilljs.com> | 2020-02-28 10:44:15 +0100 |
---|---|---|
committer | Joas Schilling <coding@schilljs.com> | 2020-02-28 10:44:15 +0100 |
commit | a92ab7774792c916946b99f346d5a0cc8a5bb173 (patch) | |
tree | 5a467db67c3b977a9f56b16c2a00b11234be2230 /core/Controller/AvatarController.php | |
parent | d7523c7f4eeb79f68ecacf72c075752a0dd03603 (diff) | |
download | nextcloud-server-a92ab7774792c916946b99f346d5a0cc8a5bb173.tar.gz nextcloud-server-a92ab7774792c916946b99f346d5a0cc8a5bb173.zip |
Also cache avatars when it's not allowed
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'core/Controller/AvatarController.php')
-rw-r--r-- | core/Controller/AvatarController.php | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 7ec338467c6..5ecdc91db24 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -134,13 +134,15 @@ class AvatarController extends Controller { if ($scope !== IAccountManager::VISIBILITY_PUBLIC && $this->userId === null) { // Public avatar access is not allowed - return new JSONResponse([], Http::STATUS_NOT_FOUND); + $response = new JSONResponse([], Http::STATUS_NOT_FOUND); + $response->cacheFor(1800); + return $response; } try { $avatar = $this->avatarManager->getAvatar($userId); $avatarFile = $avatar->getFile($size); - $resp = new FileDisplayResponse( + $response = new FileDisplayResponse( $avatarFile, $avatar->isCustomAvatar() ? Http::STATUS_OK : Http::STATUS_CREATED, ['Content-Type' => $avatarFile->getMimeType()] @@ -150,8 +152,8 @@ class AvatarController extends Controller { } // Cache for 30 minutes - $resp->cacheFor(1800); - return $resp; + $response->cacheFor(1800); + return $response; } /** |