Skip to content

3.11/CGNMAINT-114: Add EscapeForJson method

Julien QUILEZ-BONO requested to merge 3.11/CGNMAINT-114 into 3.11/sprint

TOUTES les cases doivent être cochées avant le merge. Si aucune action n'est nécessaire pour une des cases, la cocher quand même (cela permet de savoir que tout est terminé).

The ticket is already fixed, but we have still way to trigger similar bugs.

The bug was that the user inserted " inside the message. So, when calling the API, the returned json was invalid. The fix was to escape each ".

In Json, we must also escape other characters like \ . So currently adding \ inside the message trigger the bug.

Adding an EscapeForJson method, that handle all characters that must be escaped in a string, when this one will be inserted in a json data.

Note: When this commit will be merged, we must call escape_for_json instead of escape_double_quotes, in cgn repository. Ideally, this function must be called for all user inputs data, in order to avoid to return invalid json and broke the API.

Edited by Julien QUILEZ-BONO

Merge request reports