Fixed the NodeAjaxOtionsControl formatter, which was causing malformed

string, when have special character.
pull/3/head
Murtuza Zabuawala 2016-02-03 16:41:06 +05:30 committed by Ashesh Vashi
parent 79cd9d518c
commit 359dff0f78
1 changed files with 2 additions and 2 deletions

View File

@ -8,11 +8,11 @@ function($, _, pgAdmin, Backbone, Backform, Alertify, Node) {
var StringOrJSONFormatter = function() {}; var StringOrJSONFormatter = function() {};
_.extend(StringOrJSONFormatter.prototype, { _.extend(StringOrJSONFormatter.prototype, {
fromRaw: function(rawData, model) { fromRaw: function(rawData, model) {
return JSON.stringify(rawData); return JSON.stringify(_.escape(rawData));
}, },
toRaw: function(formattedData, model) { toRaw: function(formattedData, model) {
if (typeof(formattedData) == 'string') { if (typeof(formattedData) == 'string') {
return formattedData; return _.unescape(formattedData);
} }
return JSON.parse(formattedData); return JSON.parse(formattedData);
} }