Do not allow all file extensions for egg image in egg importer (#2279)

This commit is contained in:
Boy132
2026-03-22 19:18:46 +01:00
committed by GitHub
parent 612041e1f8
commit b693d0e728

View File

@@ -264,7 +264,7 @@ class EggImporterService
return;
}
$extension = $matches[1];
$extension = strtolower($matches[1]);
$data = base64_decode($matches[2]);
if (!$data) {
@@ -272,11 +272,17 @@ class EggImporterService
}
$normalizedExtension = match ($extension) {
'svg+xml' => 'svg',
'jpeg' => 'jpg',
default => $extension,
'svg+xml', 'svg' => 'svg',
'jpeg', 'jpg' => 'jpg',
'png' => 'png',
'webp' => 'webp',
default => null,
};
if (is_null($normalizedExtension)) {
return;
}
Storage::disk('public')->put(Egg::ICON_STORAGE_PATH . "/$egg->uuid.$normalizedExtension", $data);
}