Skip to content

Commit

Permalink
Merge pull request #3 from stdex/stdex-patch-2
Browse files Browse the repository at this point in the history
Constraints: check extension by lower case
  • Loading branch information
slince committed Dec 7, 2022
2 parents 18d6336 + c864319 commit 6c10ed4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Constraint/ExtensionConstraint.php
Expand Up @@ -19,15 +19,15 @@ class ExtensionConstraint implements ConstraintInterface

public function __construct(array $allowedExtensions)
{
$this->allowedExtensions = $allowedExtensions;
$this->allowedExtensions = array_map('strtolower', $allowedExtensions);
}

/**
* {@inheritdoc}
*/
public function validate(UploadedFile $file): bool
{
return in_array($file->getClientOriginalExtension(), $this->allowedExtensions);
return in_array(strtolower($file->getClientOriginalExtension()), $this->allowedExtensions);
}

/**
Expand Down

0 comments on commit 6c10ed4

Please sign in to comment.