Merge pull request #11593 from annando/avatar-basepath

Ensure that the avatar base path exists
This commit is contained in:
Tobias Diekershoff 2022-06-03 15:04:21 +02:00 committed by GitHub
commit 69c8bd3b5e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View 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;