From: Michael Date: Fri, 3 Jun 2022 05:28:10 +0000 (+0000) Subject: Ensure that the avatar base path exists X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=5442d09cc130206171f734e84afbed1c01c195ce;p=friendica.git Ensure that the avatar base path exists --- diff --git a/src/Contact/Avatar.php b/src/Contact/Avatar.php index bca8d20048..d63ebe5b6d 100644 --- a/src/Contact/Avatar.php +++ b/src/Contact/Avatar.php @@ -147,6 +147,13 @@ class Avatar DI::profiler()->startRecording('file'); + if (!file_exists($dirpath)) { + if (!mkdir($dirpath, 0775)) { + Logger::warning('Base directory could not be created', ['directory' => $dirpath]); + return ''; + } + } + // Fetch the permission and group ownership of the "avatar" path and apply to all files $dir_perm = fileperms($dirpath) & 0777; $file_perm = fileperms($dirpath) & 0666;