More precise detection for self reference variable on templates (#8814)

This should close the bug #8773
This commit is contained in:
Denis Doria
2017-07-12 06:54:32 +02:00
committed by Torkel Ödegaard
parent 2d99518f90
commit 89822acf38
@@ -77,7 +77,7 @@ export class VariableEditorCtrl {
return false;
}
if ($scope.current.type === 'query' && $scope.current.query.match(new RegExp('\\$' + $scope.current.name))) {
if ($scope.current.type === 'query' && $scope.current.query.match(new RegExp('\\$' + $scope.current.name + '(/| |$)'))) {
$scope.appEvent('alert-warning', ['Validation', 'Query cannot contain a reference to itself. Variable: $' + $scope.current.name]);
return false;
}