mirror of
https://github.com/ansible/awx.git
synced 2026-03-13 23:17:32 -02:30
ToJSON fix
Expanded the list of things the ToJSON method can accept
This commit is contained in:
@@ -88,7 +88,7 @@ angular.module('VariablesHelper', ['Utilities'])
|
||||
if (parseType === 'json') {
|
||||
try {
|
||||
// perform a check to see if the user cleared the field completly
|
||||
if(variables === "" ){
|
||||
if(variables.trim() === "" || variables.trim() === "{" || variables.trim() === "}" ){
|
||||
variables = "{}";
|
||||
}
|
||||
//parse a JSON string
|
||||
@@ -104,10 +104,11 @@ angular.module('VariablesHelper', ['Utilities'])
|
||||
$log.error('Failed to parse JSON string. Parser returned: ' + e.message);
|
||||
ProcessErrors(null, variables, e.message, null, { hdr: 'Error!',
|
||||
msg: 'Failed to parse JSON string. Parser returned: ' + e.message });
|
||||
throw 'Parse error. Failed to parse variables.';
|
||||
}
|
||||
} else {
|
||||
try {
|
||||
if(variables === ""){
|
||||
if(variables.trim() === "" || variables.trim() === "-" || variables.trim() === "--"){
|
||||
variables = '---';
|
||||
}
|
||||
json_data = jsyaml.load(variables);
|
||||
|
||||
Reference in New Issue
Block a user