@@ -354,8 +354,8 @@ public function setAllowUnrecognizedTypes(bool $allow): self
354
354
public function setTypeDefinition (string $ type , array $ mimeTypes , array $ extensions ): self
355
355
{
356
356
$ this ->config ['aggregate_types ' ][$ type ] = [
357
- 'mime_types ' => $ mimeTypes ,
358
- 'extensions ' => $ extensions ,
357
+ 'mime_types ' => array_map ( ' strtolower ' , $ mimeTypes) ,
358
+ 'extensions ' => array_map ( ' strtolower ' , $ extensions) ,
359
359
];
360
360
361
361
return $ this ;
@@ -439,6 +439,8 @@ public function withOptions(array $options): self
439
439
*/
440
440
public function inferAggregateType (string $ mimeType , string $ extension ): string
441
441
{
442
+ $ mimeType = strtolower ($ mimeType );
443
+ $ extension = strtolower ($ extension );
442
444
$ allowedTypes = $ this ->config ['allowed_aggregate_types ' ] ?? [];
443
445
$ typesForMime = $ this ->possibleAggregateTypesForMimeType ($ mimeType );
444
446
$ typesForExtension = $ this ->possibleAggregateTypesForExtension ($ extension );
@@ -782,9 +784,10 @@ private function verifySource(): void
782
784
*/
783
785
private function verifyMimeType (string $ mimeType ): string
784
786
{
787
+ $ mimeType = strtolower ($ mimeType );
785
788
$ allowed = $ this ->config ['allowed_mime_types ' ] ?? [];
786
- if (!empty ($ allowed ) && !in_array (strtolower ( $ mimeType) , $ allowed )) {
787
- throw FileNotSupportedException::mimeRestricted (strtolower ( $ mimeType) , $ allowed );
789
+ if (!empty ($ allowed ) && !in_array ($ mimeType , $ allowed )) {
790
+ throw FileNotSupportedException::mimeRestricted ($ mimeType , $ allowed );
788
791
}
789
792
790
793
return $ mimeType ;
@@ -798,9 +801,10 @@ private function verifyMimeType(string $mimeType): string
798
801
*/
799
802
private function verifyExtension (string $ extension ): string
800
803
{
804
+ $ extension = strtolower ($ extension );
801
805
$ allowed = $ this ->config ['allowed_extensions ' ] ?? [];
802
- if (!empty ($ allowed ) && !in_array (strtolower ( $ extension) , $ allowed )) {
803
- throw FileNotSupportedException::extensionRestricted (strtolower ( $ extension) , $ allowed );
806
+ if (!empty ($ allowed ) && !in_array ($ extension , $ allowed )) {
807
+ throw FileNotSupportedException::extensionRestricted ($ extension , $ allowed );
804
808
}
805
809
806
810
return $ extension ;
0 commit comments