Skip to content

Commit

Permalink
Add error handling if URL is not parse-able
Browse files Browse the repository at this point in the history
  • Loading branch information
rverton committed Nov 29, 2020
1 parent 0d52a1e commit eb56e98
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion webanalyze.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,10 @@ func (wa *WebAnalyzer) Process(job *Job) (Result, []string) {

// fix missing http scheme
u, err := url.Parse(job.URL)
if err != nil {
return Result{Host: job.URL, Error: err}, []string{}
}

if u.Scheme == "" {
u.Scheme = "http"
}
Expand Down Expand Up @@ -152,7 +156,7 @@ func sameUrl(u1, u2 *url.URL) bool {
u1.RequestURI() == u2.RequestURI()
}

func resolveLink( base *url.URL, val string, searchSubdomain bool ) string {
func resolveLink(base *url.URL, val string, searchSubdomain bool) string {
u, err := url.Parse(val)
if err != nil {
return ""
Expand Down

0 comments on commit eb56e98

Please sign in to comment.