GlennRicaud/data-toolbox-app

JSON escaping is not done properly for PropertySet

Closed this issue · 3 comments

Simple text \" in "Text Component"

{
      "type": "text",
      "path": "/main/0",
      "text": {
        "value": "<p>\"</p>
"
      }
    }

is impossible to edit (or view) in "Display Info" -> "Display Properties" view.

Browser's console outputs

SyntaxError: Unexpected token < in JSON at position 61

Because the response from http://localhost:8080/admin/tool/systems.rcd.enonic.datatoolbox/data-toolbox/_/service/systems.rcd.enonic.datatoolbox/property-list is indeed invalid JSON:

{"success":{"hits":[{"name":"value","index":0,"value":"<p>\\"</p>\n","type":"String"}],"total":1}}

I guess, the bug is actually here https://github.com/GlennRicaud/fwk-core/blob/8903dd521890b16389c602915f297e30fb5c2c8b/src/main/java/systems/rcd/fwk/core/format/json/impl/RcdSimpleJsonService.java#L119

Thanks Sergey. I will switch a proper library :)
Urgent or can it wait this week-end?

Take your time. We prefer quality. 👍🏼

Fixed.
Will be released with DT 5.0.22