Skip to content

Commit 8bb318d

Browse files
author
gregorgololicic
committed
url basic validation
1 parent 3f108cc commit 8bb318d

1 file changed

Lines changed: 6 additions & 4 deletions

File tree

util/util.go

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import (
44
"errors"
55
"fmt"
66
"os"
7+
"strings"
78

89
"github.com/manifoldco/promptui"
910
"github.com/onflow/flow-go-sdk/client"
@@ -19,10 +20,11 @@ var SilentErr = errors.New("SilentErr")
1920
func PromptURL() {
2021

2122
validate := func(input string) error {
22-
/*_, err := strconv.ParseFloat(input, 64)
23-
if err != nil {
24-
return errors.New("Invalid url")
25-
}*/
23+
i := strings.Index(input, ":")
24+
if i < 0 {
25+
return errors.New("Invalid URL")
26+
}
27+
2628
return nil
2729
}
2830

0 commit comments

Comments
 (0)