Quellcode durchsuchen

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

This should close the bug #8773
Denis Doria vor 8 Jahren
Ursprung
Commit
89822acf38
1 geänderte Dateien mit 1 neuen und 1 gelöschten Zeilen
  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;
         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]);
         $scope.appEvent('alert-warning', ['Validation', 'Query cannot contain a reference to itself. Variable: $'  + $scope.current.name]);
         return false;
         return false;
       }
       }