Throw error if image doesn't have an extension #1446

This commit is contained in:
Chris Hunt
2025-07-11 16:19:34 +01:00
parent f197aeb013
commit 22f66d35e5

View File

@@ -250,6 +250,9 @@ class ItemController extends Controller
$file = $request->input('icon');
$path_parts = pathinfo($file);
if (!isset($path_parts['extension'])) {
throw ValidationException::withMessages(['file' => 'Icon URL must have a valid file extension.']);
}
$extension = $path_parts['extension'];
$contents = file_get_contents($request->input('icon'), false, stream_context_create($options));