소스 검색

Merge pull request #476 from kubecost/niko/time-param-fix

Fix panic on empty time param string
Ajay Tripathy 6 년 전
부모
커밋
eea6e0e52e
1개의 변경된 파일3개의 추가작업 그리고 0개의 파일을 삭제
  1. 3 0
      pkg/costmodel/router.go

+ 3 - 0
pkg/costmodel/router.go

@@ -154,6 +154,9 @@ func filterFields(fields string, data map[string]*CostData) map[string]CostData
 }
 
 func normalizeTimeParam(param string) (string, error) {
+	if param == "" {
+		return "", fmt.Errorf("invalid time param")
+	}
 	// convert days to hours
 	if param[len(param)-1:] == "d" {
 		count := param[:len(param)-1]