simplify "stay on domain" logic
This commit is contained in:
parent
eea0aee587
commit
d80caeb6bb
@ -62,12 +62,12 @@ func Pages(base string) <-chan Link {
|
|||||||
for len(links) > 0 {
|
for len(links) > 0 {
|
||||||
l := links[0]
|
l := links[0]
|
||||||
links = links[1:]
|
links = links[1:]
|
||||||
if !(strings.HasPrefix(l.To, base) || strings.HasPrefix(l.To, "/")) {
|
if strings.HasPrefix(l.To, "/") {
|
||||||
continue
|
|
||||||
}
|
|
||||||
if !strings.HasPrefix(l.To, base) && strings.HasPrefix(l.To, "/") {
|
|
||||||
l.To = base + l.To
|
l.To = base + l.To
|
||||||
}
|
}
|
||||||
|
if !strings.HasPrefix(l.To, base) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
// drop fragments
|
// drop fragments
|
||||||
h := strings.Index(l.To, "#")
|
h := strings.Index(l.To, "#")
|
||||||
|
Loading…
Reference in New Issue
Block a user