Sfoglia il codice sorgente

[api] fix right value regex pattern of expression api.

https://github.com/open-falcon/falcon-plus/issues/331 follow up.
liyichao 6 anni fa
parent
commit
caa50c18ae

+ 1 - 1
modules/api/app/controller/expression/expression_controller.go

@@ -192,7 +192,7 @@ type ActionTmpU struct {
 
 func (this APIUpdateExrpessionInput) CheckFormat() (err error) {
 	validOp := regexp.MustCompile(`^(>|=|<|!)(=)?$`)
-	validRightValue := regexp.MustCompile(`^\d+$`)
+	validRightValue := regexp.MustCompile(`^\-?\d+(\.\d+)?$`)
 	switch {
 	case !validOp.MatchString(this.Op):
 		err = errors.New("op's formating is not vaild")