]> git.mxchange.org Git - friendica.git/commitdiff
Ensure that the avatar base path exists
authorMichael <heluecht@pirati.ca>
Fri, 3 Jun 2022 05:28:10 +0000 (05:28 +0000)
committerMichael <heluecht@pirati.ca>
Fri, 3 Jun 2022 05:28:10 +0000 (05:28 +0000)
src/Contact/Avatar.php

index bca8d20048e6e0e943a80e4579e13bf0e07e915c..d63ebe5b6d6cb80f2eac8f039551886244c2eb58 100644 (file)
@@ -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;