From 8192b79b1f3755e4d99d83114b157e000ee3dcaf Mon Sep 17 00:00:00 2001 From: Keith Grant Date: Tue, 10 Sep 2019 10:44:19 -0700 Subject: [PATCH] fix NT validation of headers after saving --- awx/ui/client/src/notifications/add/add.controller.js | 2 +- awx/ui/client/src/notifications/edit/edit.controller.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/awx/ui/client/src/notifications/add/add.controller.js b/awx/ui/client/src/notifications/add/add.controller.js index 0be8962b3f..d2dbf279f2 100644 --- a/awx/ui/client/src/notifications/add/add.controller.js +++ b/awx/ui/client/src/notifications/add/add.controller.js @@ -105,7 +105,7 @@ export default ['Rest', 'Wait', 'NotificationsFormObject', $scope.$watch('headers', function validate_headers(str) { try { - let headers = JSON.parse(str); + const headers = typeof str === 'string' ? JSON.parse(str) : str; if (_.isObject(headers) && !_.isArray(headers)) { let valid = true; for (let k in headers) { diff --git a/awx/ui/client/src/notifications/edit/edit.controller.js b/awx/ui/client/src/notifications/edit/edit.controller.js index a78b4c9c78..afafd35958 100644 --- a/awx/ui/client/src/notifications/edit/edit.controller.js +++ b/awx/ui/client/src/notifications/edit/edit.controller.js @@ -189,7 +189,7 @@ export default ['Rest', 'Wait', $scope.$watch('headers', function validate_headers(str) { try { - let headers = JSON.parse(str); + const headers = typeof str === 'string' ? JSON.parse(str) : str; if (_.isObject(headers) && !_.isArray(headers)) { let valid = true; for (let k in headers) {