Skip to content

Commit 1a48f18

Browse files
committed
fix: use MIME types for accepted file types capability
Change AcceptedFileTypesCapability to expect MIME types (e.g. image/png, application/pdf) instead of file extensions. Filament's acceptedFileTypes() requires MIME types, and using mimetypes validation rule is more precise than mimes.
1 parent dd42685 commit 1a48f18

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Validation/Capabilities/AcceptedFileTypesCapability.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function formSchema(string $statePath): array
2727
return [
2828
TagsInput::make($statePath.'.accepted_types')
2929
->label('Accepted File Types')
30-
->placeholder('e.g. jpg, png, pdf'),
30+
->placeholder('e.g. image/png, application/pdf'),
3131
];
3232
}
3333

@@ -51,6 +51,6 @@ public function toRules(mixed $value): array
5151
return [];
5252
}
5353

54-
return ['mimes:'.implode(',', $types)];
54+
return ['mimetypes:'.implode(',', $types)];
5555
}
5656
}

0 commit comments

Comments
 (0)