path.go 275 B

12345678910
  1. package tool
  2. // IsSameSiteURLPath returns true if the URL path belongs to the same site, false otherwise.
  3. // False: //url, http://url, /\url
  4. // True: /url
  5. func IsSameSiteURLPath(url string) bool {
  6. return len(url) >= 2 && url[0] == '/' && url[1] != '/' && url[1] != '\\'
  7. }