Skip to content

Commit 8d2c892

Browse files
committed
refactor(super-magic-module): improve file type determination in ToolProcessor by adding image format handling
1 parent 97d76f8 commit 8d2c892

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

backend/super-magic-module/src/Infrastructure/Utils/ToolProcessor.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,16 @@ private static function getRandomFile(array $files): ?array
173173
*/
174174
private static function determineFileType(string $extension): string
175175
{
176-
return match (strtolower($extension)) {
176+
$extension = strtolower($extension);
177+
178+
// Image formats
179+
$imageExtensions = ['jpg', 'jpeg', 'png', 'gif', 'bmp', 'webp', 'svg', 'ico', 'tiff', 'tif'];
180+
181+
if (in_array($extension, $imageExtensions)) {
182+
return 'image';
183+
}
184+
185+
return match ($extension) {
177186
'html' => 'html',
178187
'md' => 'md',
179188
default => 'text'

0 commit comments

Comments
 (0)