aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoas Schilling <213943+nickvergessen@users.noreply.github.com>2020-02-28 12:27:58 +0100
committerGitHub <noreply@github.com>2020-02-28 12:27:58 +0100
commit7b7d69d5da25e5bea12d914bb0caaa35cc9c3e7a (patch)
tree50a5fe1b7ef50d577f9d035686d13016aa177e1d
parent42157337cfb2dae72cb11c589bdb1c2db4d19774 (diff)
parenta92ab7774792c916946b99f346d5a0cc8a5bb173 (diff)
downloadnextcloud-server-7b7d69d5da25e5bea12d914bb0caaa35cc9c3e7a.tar.gz
nextcloud-server-7b7d69d5da25e5bea12d914bb0caaa35cc9c3e7a.zip
Merge pull request #19694 from nextcloud/bugfix/noid/cache-404-avatar-responses-too
Also cache avatars when it's not allowed
-rw-r--r--core/Controller/AvatarController.php10
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;
}
/**