Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bugfix of LFM response structure: case of unsuccessful upload #80

Merged
merged 3 commits into from
Jul 31, 2018

Conversation

RihardsZ
Copy link
Contributor

CKEditor expects error response of following structure:
[ 'uploaded': 0, 'error': [ 'message': someText ] ]

But LVM is sending just an array of error messages:
[msg1, msg2, ...]

This PR overrides LFM UploadController to correct that behaviour.

@coveralls
Copy link

coveralls commented Jul 30, 2018

Coverage Status

Coverage decreased (-0.009%) to 2.156% when pulling 01e9e5d on RihardsZ:master into da99d47 on arbory:master.

{
$response = parent::upload();

return count($this->errors) > 0 ? $this->errorResponse() : $response;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this really work?
$this->errors is never populated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is in unisharp/laravel-filemanager versions below 2.0

protected function errorResponse()
{
$responseType = request()->input('responseType');
if ($responseType && $responseType == 'json') {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

request('responseType') === 'json' would be simpler

@roboc roboc merged commit 871acef into arbory:master Jul 31, 2018
rerzy pushed a commit to rerzy/arbory that referenced this pull request Mar 7, 2019
Bugfix of LFM response structure: case of unsuccessful upload
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants