Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-05-07 09:48:38 +0300
committerJohn Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>2018-06-13 19:46:04 +0300
commiteea6f74ca47e94f6b740dbd33d10e22faf4221a5 (patch)
tree41065c0960957f64daae24850410cd7750262ada /core/Controller
parentc1766b2abc82a21b578824fe24dc38b007163424 (diff)
Controller tests fixes
Signed-off-by: John Molakvoæ (skjnldsv) <skjnldsv@protonmail.com>
Diffstat (limited to 'core/Controller')
-rw-r--r--core/Controller/AvatarController.php22
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 {