fish2018/pansou · error
跳转接口返回无效链接
Error message
跳转接口返回无效链接
What it means
Validation guard in ting77 resolveLink: a redirect was received and Location was non-empty, but url.Parse failed or the URL lacks scheme/host. The redirect target itself is malformed — a relative or garbage Location header.
Solutions
- Resolve relative Locations against the request URL before validating
- Skip entries whose redirect target stays malformed
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at plugin/ting77/ting77.go:257 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of fish2018/pansou@beaa561337 (2026-09-07).
Data as JSON: /api/errors/5ec9783062f4feaf.
Report an issue: GitHub.
Appendix: source
Thrown at plugin/ting77/ting77.go:257
CheckRedirect: func(_ *http.Request, _ []*http.Request) error {
return http.ErrUseLastResponse
},
}
resp, err := redirectClient.Do(req)
if err != nil {
lastErr = err
continue
}
io.Copy(io.Discard, io.LimitReader(resp.Body, 512<<10))
resp.Body.Close()
location := strings.TrimSpace(resp.Header.Get("Location"))
if resp.StatusCode < 300 || resp.StatusCode >= 400 || location == "" {
lastErr = fmt.Errorf("跳转接口返回状态码 %d", resp.StatusCode)
continue
}
resolved, err := url.Parse(location)
if err != nil || resolved.Scheme == "" || resolved.Host == "" {
lastErr = fmt.Errorf("跳转接口返回无效链接")
continue
}
linkType := detectLinkType(location)
if linkType == "others" {
lastErr = fmt.Errorf("跳转接口返回不支持的链接: %s", resolved.Host)
continue
}
link := model.Link{
Type: linkType,
URL: location,
Password: extractPassword(location),
Datetime: entry.Datetime,
WorkTitle: entry.Title,
}
p.linkCache.Store(cacheKey, link)
return link, nil
}
return model.Link{}, lastErrView on GitHub (pinned to beaa561337)