From 478f2429f5146c68092a3bae7f5589cab49c299b Mon Sep 17 00:00:00 2001 From: Kilian Hofmann Date: Mon, 29 Jul 2024 23:48:36 +0200 Subject: [PATCH] File deletes --- exam/classes/Models/User/User.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/exam/classes/Models/User/User.php b/exam/classes/Models/User/User.php index 0b47a50..9f31f1d 100644 --- a/exam/classes/Models/User/User.php +++ b/exam/classes/Models/User/User.php @@ -593,7 +593,7 @@ class User implements JsonSerializable // Delete old picture if it isn't a default one and if it exists. try { - if (strpos($oldImage, "default") === false && file_exists(Config::getStorageFSPath() . $this->image)) unlink(Config::getStorageFSPath() . $oldImage); + if (strpos($oldImage, "default") === false && is_file(Config::getStorageFSPath() . $oldImage)) unlink(Config::getStorageFSPath() . $oldImage); } catch (Exception $e) { } @@ -624,7 +624,7 @@ class User implements JsonSerializable // Delete picture if it isn't a default one and if it exists. try { - if (strpos($this->image, "default") === false && file_exists(Config::getStorageFSPath() . $this->image)) unlink(Config::getStorageFSPath() . $this->image); + if (strpos($this->image, "default") === false && is_file(Config::getStorageFSPath() . $this->image)) unlink(Config::getStorageFSPath() . $this->image); } catch (Exception $e) { }