Skip to content

Commit

Permalink
Merge pull request #48 from JurianVW/main
Browse files Browse the repository at this point in the history
Fixed bug where isValidMediaFileArray in the DefaultFormRequest could throw an error if the value is not an array
  • Loading branch information
JurianVW authored Jan 16, 2025
2 parents f52c735 + 3835434 commit aa7780c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Changelog

## Unreleased
- Fixed bug where isValidMediaFileArray in the DefaultFormRequest could throw an error if the value is not an array.

## v0.2.1
- Fixed bug where prepareForValidation in the DefaultFormRequest could overwrite previous changes made to the input.
Expand Down
4 changes: 4 additions & 0 deletions src/Http/Controllers/Requests/DefaultFormRequest.php
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ private function isValidMediaArray(array $array): bool
private function isValidMediaFileArray(array $array): bool
{
foreach ($array as $value) {
if (empty($value)) {
return false;
}

foreach ($value as $item) {
if (! ($item instanceof MediaFile)) {
return false;
Expand Down

0 comments on commit aa7780c

Please sign in to comment.