Skip to content

Commit 0fdd266

Browse files
committed
Fixes issue with attaching media
Signed-off-by: Sam Poyigi <6567634+sampoyigi@users.noreply.github.com>
1 parent 2682642 commit 0fdd266

1 file changed

Lines changed: 3 additions & 4 deletions

File tree

app/admin/formwidgets/MediaFinder.php

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -131,8 +131,7 @@ public function getMediaPath($media)
131131

132132
try {
133133
return MediaLibrary::instance()->getMediaRelativePath(trim($media, '/'));
134-
}
135-
catch (SystemException $ex) {
134+
} catch (SystemException $ex) {
136135
return $media;
137136
}
138137
}
@@ -238,13 +237,13 @@ public function onAddAttachment()
238237
));
239238
}
240239

241-
$items = $this->validate(request()->input(), [
240+
$data = $this->validate(request()->input(), [
242241
'items' => ['required', 'array'],
243242
'items.*.name' => ['required', 'string'],
244243
'items.*.path' => ['required', 'string'],
245244
]);
246245

247-
if (!is_array($items))
246+
if (!is_array($items = array_get($data, 'items')))
248247
throw new ApplicationException(lang('main::lang.media_manager.alert_select_item_to_attach'));
249248

250249
$model = $this->model;

0 commit comments

Comments
 (0)