MCPcopy
hub / github.com/jaeles-project/gospider / FixUrl

Function FixUrl

core/utils.go:72–78  ·  view source on GitHub ↗

func FixUrl(site *url.URL, nextLoc string) string { var newUrl string if strings.HasPrefix(nextLoc, "//") { google.com/example.php newUrl = site.Scheme + ":" + nextLoc } else if strings.HasPrefix(nextLoc, "http") { http://google.com || https://google.com newUrl = nextLoc } else if !strings.HasPref

(mainSite *url.URL, nextLoc string)

Source from the content-addressed store, hash-verified

70// }
71
72func FixUrl(mainSite *url.URL, nextLoc string) string {
73 nextLocUrl, err := url.Parse(nextLoc)
74 if err != nil {
75 return ""
76 }
77 return mainSite.ResolveReference(nextLocUrl).String()
78}
79
80func Unique(intSlice []string) []string {
81 keys := make(map[string]bool)

Callers 3

StartMethod · 0.85
setupLinkFinderMethod · 0.85
ParseRobotsFunction · 0.85

Calls 1

StringMethod · 0.80

Tested by

no test coverage detected