File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -43,16 +43,23 @@ public function upload()
4343 }
4444
4545 if (is_array ($ uploaded_files )) {
46- $ response = count ($ error_bag ) > 0 ? $ error_bag : array ( parent ::$ success_response) ;
47- } else { // upload via ckeditor 'Upload' tab
46+ $ response = count ($ error_bag ) > 0 ? $ error_bag : parent ::$ success_response ;
47+ } else { // upload via ckeditor5 expects json responses
4848 if (is_null ($ new_filename )) {
49- $ response = $ error_bag [0 ];
49+ $ response = ['error ' =>
50+ [
51+ 'message ' => $ error_bag [0 ]
52+ ]
53+ ];
5054 } else {
51- $ response = view (Lfm::PACKAGE_NAME . '::use ' )
52- ->withFile ($ this ->lfm ->setName ($ new_filename )->url ());
55+ $ url = $ this ->lfm ->setName ($ new_filename )->url ();
56+
57+ $ response = [
58+ 'url ' => $ url
59+ ];
5360 }
5461 }
5562
56- return json_encode ($ response );
63+ return response ()-> json ($ response );
5764 }
5865}
You can’t perform that action at this time.
0 commit comments