diff options
author | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-05-07 08:48:38 +0200 |
---|---|---|
committer | John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com> | 2018-06-13 18:46:04 +0200 |
commit | eea6f74ca47e94f6b740dbd33d10e22faf4221a5 (patch) | |
tree | 41065c0960957f64daae24850410cd7750262ada /core/Controller | |
parent | c1766b2abc82a21b578824fe24dc38b007163424 (diff) | |
download | nextcloud-server-eea6f74ca47e94f6b740dbd33d10e22faf4221a5.tar.gz nextcloud-server-eea6f74ca47e94f6b740dbd33d10e22faf4221a5.zip |
Controller tests fixes
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core/Controller')
-rw-r--r-- | core/Controller/AvatarController.php | 22 |
1 files changed, 16 insertions, 6 deletions
diff --git a/core/Controller/AvatarController.php b/core/Controller/AvatarController.php index 6f0cf03d8e8..e5a8e4fe29c 100644 --- a/core/Controller/AvatarController.php +++ b/core/Controller/AvatarController.php @@ -8,6 +8,7 @@ * @author Roeland Jago Douma <roeland@famdouma.nl> * @author Thomas Müller <thomas.mueller@tmit.eu> * @author Vincent Petry <pvince81@owncloud.com> + * @author John Molakvoæ <skjnldsv@protonmail.com> * * @license AGPL-3.0 * @@ -146,13 +147,22 @@ class AvatarController extends Controller { $size = 64; } + // Serve png as a fallback only if ($png === false) { - $avatar = $this->avatarManager->getAvatar($userId)->getAvatarVector($size); - $resp = new DataDisplayResponse( - $avatar, - Http::STATUS_OK, - ['Content-Type' => 'image/svg+xml' - ]); + + try { + $avatar = $this->avatarManager->getAvatar($userId)->getAvatarVector($size); + $resp = new DataDisplayResponse( + $avatar, + Http::STATUS_OK, + ['Content-Type' => 'image/svg+xml' + ]); + } catch (\Exception $e) { + $resp = new Http\Response(); + $resp->setStatus(Http::STATUS_NOT_FOUND); + return $resp; + } + } else { try { |