Skip to content

Commit

Permalink
Fixes issue with attaching media
Browse files Browse the repository at this point in the history
Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
  • Loading branch information
sampoyigi committed Oct 3, 2023
1 parent 2682642 commit 0fdd266
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions app/admin/formwidgets/MediaFinder.php
Expand Up @@ -131,8 +131,7 @@ public function getMediaPath($media)

try {
return MediaLibrary::instance()->getMediaRelativePath(trim($media, '/'));
}
catch (SystemException $ex) {
} catch (SystemException $ex) {
return $media;
}
}
Expand Down Expand Up @@ -238,13 +237,13 @@ public function onAddAttachment()
));
}

$items = $this->validate(request()->input(), [
$data = $this->validate(request()->input(), [
'items' => ['required', 'array'],
'items.*.name' => ['required', 'string'],
'items.*.path' => ['required', 'string'],
]);

if (!is_array($items))
if (!is_array($items = array_get($data, 'items')))
throw new ApplicationException(lang('main::lang.media_manager.alert_select_item_to_attach'));

$model = $this->model;
Expand Down

0 comments on commit 0fdd266

Please sign in to comment.