Skip to content

Commit 22f66d3

Browse files
author
Chris Hunt
committed
Throw error if image doesn't have an extension #1446
1 parent f197aeb commit 22f66d3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

app/Http/Controllers/ItemController.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,9 @@ public static function storelogic(Request $request, $id = null): Item
250250

251251
$file = $request->input('icon');
252252
$path_parts = pathinfo($file);
253+
if (!isset($path_parts['extension'])) {
254+
throw ValidationException::withMessages(['file' => 'Icon URL must have a valid file extension.']);
255+
}
253256
$extension = $path_parts['extension'];
254257

255258
$contents = file_get_contents($request->input('icon'), false, stream_context_create($options));

0 commit comments

Comments
 (0)