Skip to content

Commit aa451b7

Browse files
authored
Merge pull request #10694 from nextcloud/bug/noid/avatar-204
fix: change status code from 404 to 204 for missing avatars
2 parents bcd5239 + 92bf4ef commit aa451b7

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/Controller/AvatarsController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function url(string $email): JSONResponse {
5454
$avatar = $this->avatarService->getAvatar($email, $this->uid);
5555
if (is_null($avatar)) {
5656
// No avatar found
57-
$response = new JSONResponse([], Http::STATUS_NOT_FOUND);
57+
$response = new JSONResponse([], Http::STATUS_NO_CONTENT);
5858

5959
// Debounce this a bit
6060
// (cache for one day)

tests/Unit/Controller/AvatarControllerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ public function testGetUrlNoAvatarFound() {
7878

7979
$resp = $this->controller->url($email);
8080

81-
$expected = new JSONResponse([], Http::STATUS_NOT_FOUND);
81+
$expected = new JSONResponse([], Http::STATUS_NO_CONTENT);
8282
$expected->cacheFor(24 * 60 * 60, false, true);
8383
$this->assertEquals($expected, $resp);
8484
}

0 commit comments

Comments
 (0)