From fcd899d7bc1d18513b1d9a9ee05d83b28218d19d Mon Sep 17 00:00:00 2001 From: gconsidine Date: Tue, 4 Apr 2017 10:29:04 -0400 Subject: [PATCH] Fix issue preventing inventory groups from loading A conditional was in place to check if a URL included the base path, if so, it was supposed to use the URL as-is, otherwise it should get the URL by referencing a property in an object containing default URLs. The conditional checked only for 'api/v1'. Since we're at v2, the check failed eventually resulting in a `replace` call on an undefined value. I replaced the conditional to pattern match api/v*/ instead. --- awx/ui/client/src/shared/rbacUiControl.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/awx/ui/client/src/shared/rbacUiControl.js b/awx/ui/client/src/shared/rbacUiControl.js index 4c8a00d827..867fc4a6cb 100644 --- a/awx/ui/client/src/shared/rbacUiControl.js +++ b/awx/ui/client/src/shared/rbacUiControl.js @@ -10,7 +10,7 @@ export default this.canAdd = function(apiPath) { var canAddVal = $q.defer(); - if (apiPath.indexOf("api/v1") > -1) { + if (/api\/v[0-9]+\//.test(apiPath)) { Rest.setUrl(apiPath); } else { Rest.setUrl(GetBasePath(apiPath));