Skip to content

Commit

Permalink
account for empty set previous files
Browse files Browse the repository at this point in the history
  • Loading branch information
pxpm committed Jan 10, 2024
1 parent df79200 commit c1d776b
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/app/Library/Uploaders/MultipleFiles.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,10 @@ public function uploadFiles(Model $entry, $value = null)
$value = $value ?? collect(CRUD::getRequest()->file($this->getNameForRequest()))->flatten()->toArray();
$previousFiles = $this->getPreviousFiles($entry) ?? [];

if(is_array($previousFiles) && empty($previousFiles[0] ?? [])){
$previousFiles = [];
}

if (! is_array($previousFiles) && is_string($previousFiles)) {
$previousFiles = json_decode($previousFiles, true);
}
Expand Down

0 comments on commit c1d776b

Please sign in to comment.