mirror of
https://github.com/pelican-dev/panel.git
synced 2026-05-04 18:00:48 +03:00
Do not allow all file extensions for egg image in egg importer (#2279)
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user