Submitting a value for Templates (admin/config/media/easychart/templates) other than the default (ie. any JSON) breaks config-export/import.

The error occurs either on a cim, or subsequent cex command:

Drupal\Core\Config\UnsupportedDataTypeConfigException: Invalid data type in config easychart.settings, found    [error]
in file/home/vagrant/docroot/web/profiles/mysite_profile/config/sync/easychart.settings.yml : Malformed
inline YAML string ("[{\r\n \"id\": --snip, really long line of json

Using Drupal's Json::encode to store the config string will correct this issue. I think this probably affects Presets as well, but I dont have anything in that setting and this is all I've had time to look into.

Comments

petermallett created an issue. See original summary.

petermallett’s picture

This patch adds form validation to test the JSON submitted and encodes the text using Json::encode before storing the string value into the config system.

This necessitated a json_decode with JSON_PRETTY_PRINT be used with the form default or it was just one long line.

thomas_rz’s picture

Assigned: Unassigned » jyve
petermallett’s picture

I was trying to make some adjustments to this today and ended up making a simpler patch by factoring out the Json object since this string is never meant to be used as HTML.

juanl’s picture

patch #2 updated for version 3.5.0

  • Web-Beest committed 13e6024 on 4.x authored by juanl
    Issue #2820545 by petermallett, juanl: JSON configuration breaks config-...
web-beest’s picture

Version: 8.x-3.x-dev » 4.0.0
Assigned: jyve » web-beest
Status: Needs work » Reviewed & tested by the community
web-beest’s picture

Version: 4.0.0 » 4.0.1
Status: Reviewed & tested by the community » Fixed

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.