Introduce JSON parse utility function with error handling

Fixes #6400
This commit is contained in:
jeremy@jermolene.com
2022-01-15 13:03:43 +00:00
parent 35f7a8ea06
commit 42768ca166
18 changed files with 41 additions and 56 deletions
+1 -1
View File
@@ -18,7 +18,7 @@ exports.path = /^\/recipes\/default\/tiddlers\/(.+)$/;
exports.handler = function(request,response,state) {
var title = $tw.utils.decodeURIComponentSafe(state.params[0]),
fields = JSON.parse(state.data);
fields = $tw.utils.parseJSONSafe(state.data);
// Pull up any subfields in the `fields` object
if(fields.fields) {
$tw.utils.each(fields.fields,function(field,name) {