Skip to content

Commit 974b7e8

Browse files
committed
Check directory exist before creation; fix #21848
1 parent 11c5c93 commit 974b7e8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/User.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1069,7 +1069,9 @@ public function prepareInputForUpdate($input)
10691069
$extension = strtolower(pathinfo($fullpath, PATHINFO_EXTENSION));
10701070
$extension = in_array($extension, ['png', 'gif']) ? 'png' : 'jpg';
10711071

1072-
@mkdir(GLPI_PICTURE_DIR . "/$sub");
1072+
if (!file_exists(GLPI_PICTURE_DIR . "/$sub")) {
1073+
mkdir(GLPI_PICTURE_DIR . "/$sub");
1074+
}
10731075
$picture_path = GLPI_PICTURE_DIR . "/{$sub}/{$filename}.{$extension}";
10741076
self::dropPictureFiles("{$sub}/{$filename}.{$extension}");
10751077

0 commit comments

Comments
 (0)