Skip to content

Commit

Permalink
utility: fix URL recognition RegEx
Browse files Browse the repository at this point in the history
  • Loading branch information
Tch1b0 committed Jul 22, 2022
1 parent 462eeba commit ba12d55
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions pkg/utility/utility.go
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func PrintDone() {
}

func GetPluginName(name string) string {
if strings.HasPrefix(name, "https://") || strings.Index(name, "/") != -1 {
if strings.HasPrefix(name, "https://") || strings.Contains(name, "/") {
urlParts := strings.Split(name, "/")
return urlParts[len(urlParts)-1]
} else {
Expand Down Expand Up @@ -131,7 +131,7 @@ func GetFirstMatch[t any](slice []t, predicate func(t, int) bool) *t {
}

func IsUrl(str string) bool {
a, _ := regexp.Match(`https?:\/\/[a-zA-Z0-9_\-\.]+\.[a-zA-Z]{1,5}(\/[a-zA-Z0-9_\-\=\&\?\:]+)+`, []byte(str))
a, _ := regexp.Match(`https?:\/\/[a-zA-Z0-9_\-\.]+\.[a-zA-Z]{1,5}([a-zA-Z0-9_\/\-\=\&\?\:]+)*`, []byte(str))
return a
}

Expand Down

0 comments on commit ba12d55

Please sign in to comment.