kopia lustrzana https://github.com/nextcloud/social
Add proper NotFoundResponse if no avatar is available
Signed-off-by: Julius Härtl <jus@bitgrid.net>pull/72/head
rodzic
53b5cc29e7
commit
f92290713a
|
@ -47,6 +47,7 @@ use OCA\Social\Service\PostService;
|
|||
use OCP\AppFramework\Controller;
|
||||
use OCP\AppFramework\Http\DataResponse;
|
||||
use OCP\AppFramework\Http\FileDisplayResponse;
|
||||
use OCP\AppFramework\Http\NotFoundResponse;
|
||||
use OCP\AppFramework\Http\Response;
|
||||
use OCP\IRequest;
|
||||
|
||||
|
@ -415,11 +416,12 @@ class LocalController extends Controller {
|
|||
public function actorAvatar(string $id): Response {
|
||||
try {
|
||||
$actor = $this->personService->getFromId($id);
|
||||
$avatar = $actor->getIcon();
|
||||
$document = $this->documentService->getFromCache($avatar->getId());
|
||||
|
||||
|
||||
return new FileDisplayResponse($document);
|
||||
if ($actor->gotIcon()) {
|
||||
$avatar = $actor->getIcon();
|
||||
$document = $this->documentService->getFromCache($avatar->getId());
|
||||
return new FileDisplayResponse($document);
|
||||
}
|
||||
return new NotFoundResponse();
|
||||
} catch (Exception $e) {
|
||||
return $this->fail($e);
|
||||
}
|
||||
|
|
Ładowanie…
Reference in New Issue