Ver Fonte

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

This should close the bug #8773
Denis Doria há 8 anos atrás
pai
commit
89822acf38
1 ficheiros alterados com 1 adições e 1 exclusões
  1. 1 1
      public/app/features/templating/editor_ctrl.ts

+ 1 - 1
public/app/features/templating/editor_ctrl.ts

@@ -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;
       }