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

listAllDrivesWithHttpInfo function fails to catch and null response exception #4

Closed
S-Panta opened this issue Oct 18, 2023 · 11 comments · Fixed by OpenAPITools/openapi-generator#16879 or owncloud/libre-graph-api#146
Assignees
Labels
bug Something isn't working

Comments

@S-Panta
Copy link

S-Panta commented Oct 18, 2023

If the URL is in the wrong format, response would be null and this function doesn't throw any exception but returns null. response as null makes no sense. Thus the function should handle this exception.

Note: I have used [ocis-php-sdk] to reproduce the error.
https://github.com/owncloud/ocis-php-sdk

Steps to reproduce

Create an Ocis object using the service Url with an extra slash in it and an access token.

$ocis = new Ocis('https://example.ocis.com/', $accessToken);

The response will be returned as null.

Expected result

The function should handle the error.

@S-Panta S-Panta added the bug Something isn't working label Oct 18, 2023
@individual-it
Copy link
Member

The problem here is if the server returns a 200 response but the content is not JSON decodeble e.g. in https://github.com/owncloud/libre-graph-api-php/blob/main/lib/Api/MeDrivesApi.php#L203
json_decode returns null in that case and that is propagated upwards

@individual-it
Copy link
Member

should be fixed by OpenAPITools/openapi-generator#16879

@individual-it individual-it self-assigned this Oct 20, 2023
@individual-it
Copy link
Member

@S-Panta please retest, and check if the issue is fixed

@S-Panta
Copy link
Author

S-Panta commented Nov 24, 2023

Somehow, the body of the response of listAllDrivesWithHttpInfo() function is giving html as body response when the wrong format of URL is provided. Json can't decode that response body and it returns null as it's output. I am not if the issue is fixed. It stills give back null response.

@individual-it
Copy link
Member

@S-Panta exactly and in the current version of this library (after OpenAPITools/openapi-generator#16879) the function should not return null but throw an JsonException when it cannot decode the output.
Do you run the most recent version of this library? Please check your package.json , what version of libre-graph-api-php are you using? maybe rerun composer update?

@S-Panta
Copy link
Author

S-Panta commented Nov 24, 2023

I used the latest generation and the response is still Null.

@amrita-shrestha
Copy link
Contributor

I used the latest generation and the response is still Null.

The current image doesn't include fixed PR. I made bump PR : owncloud/libre-graph-api#143
After this Pr merge you can try

@individual-it
Copy link
Member

The bump did not do anything, it did not produce any different output

@individual-it
Copy link
Member

the issue was that we haven't applied the fix of OpenAPITools/openapi-generator#17120 in the template used in the generator, should be done by owncloud/libre-graph-api#146

@individual-it
Copy link
Member

@S-Panta please confirm if the issue is really fixed

@S-Panta
Copy link
Author

S-Panta commented Dec 1, 2023

It is fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants