From b940a1226fe3fb1d157669dff56b3d66f37e6f56 Mon Sep 17 00:00:00 2001 From: Thomas Rubini <74205383+ThomasRubini@users.noreply.github.com> Date: Tue, 24 Jan 2023 18:26:07 +0100 Subject: [PATCH] Fix - show the default image on non existant user --- Controllers/UserController.php | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/Controllers/UserController.php b/Controllers/UserController.php index 2c8eeb2..a0c927a 100644 --- a/Controllers/UserController.php +++ b/Controllers/UserController.php @@ -197,19 +197,14 @@ final class UserController $O_userModel = new UserModel(); $A_user = $O_userModel->getUserByID($A_urlParams[0]); - if (!isset($A_user)) { - throw new HTTPSpecialCaseException(404); - } - - if ($A_user["PROFILE_PIC"] === null) { - header("Content-Type: image/svg+xml"); - echo file_get_contents(Constants::rootDir()."/static/img/default_user.svg"); - } else { + if (isset($A_user) && $A_user["PROFILE_PIC"] !== null) { header("Content-Type: image"); echo $A_user["PROFILE_PIC"]; + } else { + header("Content-Type: image/svg+xml"); + echo file_get_contents(Constants::rootDir()."/static/img/default_user.svg"); } - return Utils::RETURN_RAW; }