diff options
Diffstat (limited to 'brokenlinks/worker.go')
| -rw-r--r-- | brokenlinks/worker.go | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/brokenlinks/worker.go b/brokenlinks/worker.go index 7683730..06bdcc6 100644 --- a/brokenlinks/worker.go +++ b/brokenlinks/worker.go @@ -282,11 +282,17 @@ func (wrk *worker) scan(linkq jarink.Link) (resultq map[string]jarink.Link) { var parentUrl *url.URL - parentUrl, err = url.Parse(linkq.Url) + // Check and get the redirect location or use the original URL. + location := httpResp.Header.Get(`Location`) + if location == `` { + location = linkq.Url + } + + parentUrl, err = url.Parse(location) if err != nil { linkq.StatusCode = StatusBadLink linkq.ErrScan = err - resultq[linkq.Url] = linkq + resultq[location] = linkq return resultq } |
