mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-10 00:34:50 +00:00
Update ComposeController, fix validation issue
This commit is contained in:
parent
2c208c99c4
commit
80e6a5a98f
3 changed files with 33 additions and 17 deletions
|
@ -1449,13 +1449,16 @@ class ApiV1Controller extends Controller
|
||||||
abort_if(!$request->user(), 403);
|
abort_if(!$request->user(), 403);
|
||||||
|
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'file.*' => function() {
|
'file.*' => [
|
||||||
return [
|
'required_without:file',
|
||||||
'required',
|
|
||||||
'mimetypes:' . config_cache('pixelfed.media_types'),
|
'mimetypes:' . config_cache('pixelfed.media_types'),
|
||||||
'max:' . config_cache('pixelfed.max_photo_size'),
|
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||||
];
|
],
|
||||||
},
|
'file' => [
|
||||||
|
'required_without:file.*',
|
||||||
|
'mimetypes:' . config_cache('pixelfed.media_types'),
|
||||||
|
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||||
|
],
|
||||||
'filter_name' => 'nullable|string|max:24',
|
'filter_name' => 'nullable|string|max:24',
|
||||||
'filter_class' => 'nullable|alpha_dash|max:24',
|
'filter_class' => 'nullable|alpha_dash|max:24',
|
||||||
'description' => 'nullable|string|max:' . config_cache('pixelfed.max_altext_length')
|
'description' => 'nullable|string|max:' . config_cache('pixelfed.max_altext_length')
|
||||||
|
@ -1647,13 +1650,16 @@ class ApiV1Controller extends Controller
|
||||||
abort_if(!$request->user(), 403);
|
abort_if(!$request->user(), 403);
|
||||||
|
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'file.*' => function() {
|
'file.*' => [
|
||||||
return [
|
'required_without:file',
|
||||||
'required',
|
|
||||||
'mimetypes:' . config_cache('pixelfed.media_types'),
|
'mimetypes:' . config_cache('pixelfed.media_types'),
|
||||||
'max:' . config_cache('pixelfed.max_photo_size'),
|
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||||
];
|
],
|
||||||
},
|
'file' => [
|
||||||
|
'required_without:file.*',
|
||||||
|
'mimetypes:' . config_cache('pixelfed.media_types'),
|
||||||
|
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||||
|
],
|
||||||
'filter_name' => 'nullable|string|max:24',
|
'filter_name' => 'nullable|string|max:24',
|
||||||
'filter_class' => 'nullable|alpha_dash|max:24',
|
'filter_class' => 'nullable|alpha_dash|max:24',
|
||||||
'description' => 'nullable|string|max:' . config_cache('pixelfed.max_altext_length')
|
'description' => 'nullable|string|max:' . config_cache('pixelfed.max_altext_length')
|
||||||
|
|
|
@ -75,13 +75,16 @@ class ComposeController extends Controller
|
||||||
abort_if(!$request->user(), 403);
|
abort_if(!$request->user(), 403);
|
||||||
|
|
||||||
$this->validate($request, [
|
$this->validate($request, [
|
||||||
'file.*' => function() {
|
'file.*' => [
|
||||||
return [
|
'required_without:file',
|
||||||
'required',
|
'mimetypes:' . config_cache('pixelfed.media_types'),
|
||||||
'mimetypes:' . config_cache('pixelfed.media_types'),
|
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||||
'max:' . config_cache('pixelfed.max_photo_size'),
|
],
|
||||||
];
|
'file' => [
|
||||||
},
|
'required_without:file.*',
|
||||||
|
'mimetypes:' . config_cache('pixelfed.media_types'),
|
||||||
|
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||||
|
],
|
||||||
'filter_name' => 'nullable|string|max:24',
|
'filter_name' => 'nullable|string|max:24',
|
||||||
'filter_class' => 'nullable|alpha_dash|max:24'
|
'filter_class' => 'nullable|alpha_dash|max:24'
|
||||||
]);
|
]);
|
||||||
|
|
|
@ -1192,6 +1192,13 @@ export default {
|
||||||
self.page = 2;
|
self.page = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case 500:
|
||||||
|
self.uploading = false;
|
||||||
|
io.value = null;
|
||||||
|
swal('Error', e.response.data.message, 'error');
|
||||||
|
self.page = 2;
|
||||||
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
self.uploading = false;
|
self.uploading = false;
|
||||||
io.value = null;
|
io.value = null;
|
||||||
|
|
Loading…
Reference in a new issue