-
Notifications
You must be signed in to change notification settings - Fork 265
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
Invalid JSON (quotes not escaped) #2955
Comments
Thanks for the feedback! It seems that the logic that avoids rendering fordidden chars (note that |
@arigliano , the function In this issue it has to be found why this is not being applied to the "description" field in the case of the response shown above. And fix it.
Don't hesitate to ask if you have some doubt regarding implementation. |
@fgalan Thank you for the suggestion. I've found the problem in the uriArgumentGet method.
|
Thank you for so precise and illustrative analysis of the cause of the problem :) I think the second option is the best one. That is, fixing the OrionError::toJson() to apply invalid chars transformation to its parameters. Among the two sub-options (jsonInvalidCharsTransformation or JSONHelper::toJsonString) maybe the best one is better as it doesn't requires to create a short-lived object (the JSONHelper) for just a invalidad char transformation, but I don't have an strong opinion on that. |
On a second thought, I think the point to apply the fix is correct (OrionError::toJson) but the function to use is not jsonInvalidCharsTransformation/JSONHelper::toJsonString. Note these functions do the transformation json_ivalid -> \xx. However, what it should be applied is the function that transform orion_invalid -> &xx as, by design, Orion shouldn't response with any forbidden char and
uses " In fact, I think is should be something like
@kzangeli will elaborate later today on which exact function to use to implment the orion_invalid -> &xx transformation. |
We have a function called |
Invalid chars transformation is now performed in the OrionError::toJson() method, by using the **htmlEscape** function. The test was modified accordingly.
- CHANGE_NEXT_RELEASE updated
Code cleaned
FIX Invalid JSON (quotes not escaped) #2955
Fixed by PR #3012 |
In some cases, Orion returns an HTTP response with Content-Type: application/json but with the body being invalid json.
For example, the response for the query
/v2/entities?foo"
(note the"
at the end) is:Whose body is not valid JSON. I think this problem could be solved by escaping the quotes.
The text was updated successfully, but these errors were encountered: