Fix errors in AvatarController when data() returns null

Signed-off-by: Côme Chilliet <come.chilliet@nextcloud.com>
pull/29432/head
Côme Chilliet 4 years ago
parent 8b271b8a12
commit 5a20e20e9e
No known key found for this signature in database
GPG Key ID: A3E2F658B28C760A
  1. 5
      core/Controller/AvatarController.php

@ -283,11 +283,12 @@ class AvatarController extends Controller {
$image = new \OC_Image();
$image->loadFromData($tmpAvatar);
$resp = new DataDisplayResponse($image->data(),
$resp = new DataDisplayResponse(
$image->data() ?? '',
Http::STATUS_OK,
['Content-Type' => $image->mimeType()]);
$resp->setETag((string)crc32($image->data()));
$resp->setETag((string)crc32($image->data() ?? ''));
$resp->cacheFor(0);
$resp->setLastModified(new \DateTime('now', new \DateTimeZone('GMT')));
return $resp;

Loading…
Cancel
Save