Merge pull request #7321 from pixelfed/fix/admin-directory-media-types-500

Fix AdminDirectoryController 500 on media_types validation
pull/7324/head
Shlee 1 week ago committed by GitHub
commit 6f9a7c1a88
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

@ -101,7 +101,8 @@ trait AdminDirectoryController
'media_types' => [
'required',
function ($attribute, $value, $fail) {
if (! in_array('image/jpeg', $value->toArray()) || ! in_array('image/png', $value->toArray())) {
$types = is_array($value) ? $value : collect($value)->toArray();
if (! in_array('image/jpeg', $types) || ! in_array('image/png', $types)) {
$fail('You must enable image/jpeg and image/png support.');
}
},
@ -269,7 +270,8 @@ trait AdminDirectoryController
'media_types' => [
'required',
function ($attribute, $value, $fail) {
if (! in_array('image/jpeg', $value->toArray()) || ! in_array('image/png', $value->toArray())) {
$types = is_array($value) ? $value : collect($value)->toArray();
if (! in_array('image/jpeg', $types) || ! in_array('image/png', $types)) {
$fail('You must enable image/jpeg and image/png support.');
}
},

Loading…
Cancel
Save