summaryrefslogtreecommitdiffstats
path: root/core/Controller/AvatarController.php
diff options
context:
space:
mode:
authorDaniel Kesselberg <mail@danielkesselberg.de>2020-03-01 00:42:24 +0100
committerDaniel Kesselberg <mail@danielkesselberg.de>2020-03-01 00:42:24 +0100
commit68148f4073948a39e7247c3e9b5e6a4317d25fd0 (patch)
treef03b14a5e96921c0ec1ab5118a0a5763a948f8e9 /core/Controller/AvatarController.php
parent72cc8270cdd0f1c95ef1708be81cf4ac424dca47 (diff)
downloadnextcloud-server-68148f4073948a39e7247c3e9b5e6a4317d25fd0.tar.gz
nextcloud-server-68148f4073948a39e7247c3e9b5e6a4317d25fd0.zip
Always use status 200 for avatar response
As discussed in #18603 caching a 201 response is hard. It's now possible to distinguish between generated and uploaded avatars by reading the X-NC-IsCustomAvatar (0 = generated, 1 = uploaded) header. Signed-off-by: Daniel Kesselberg <mail@danielkesselberg.de>
Diffstat (limited to 'core/Controller/AvatarController.php')
-rw-r--r--core/Controller/AvatarController.php4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php
index 7ec338467c6..7969ed063d4 100644
--- a/core/Controller/AvatarController.php
+++ b/core/Controller/AvatarController.php
@@ -142,8 +142,8 @@ class AvatarController extends Controller {
$avatarFile = $avatar->getFile($size);
$resp = new FileDisplayResponse(
$avatarFile,
- $avatar->isCustomAvatar() ? Http::STATUS_OK : Http::STATUS_CREATED,
- ['Content-Type' => $avatarFile->getMimeType()]
+ Http::STATUS_OK,
+ ['Content-Type' => $avatarFile->getMimeType(), 'X-NC-IsCustomAvatar' => (int)$avatar->isCustomAvatar()]
);
} catch (\Exception $e) {
return new JSONResponse([], Http::STATUS_NOT_FOUND);