{"record":{"id":"5ec9783062f4feaf","repo":"fish2018/pansou","slug":"error-5ec978","errorCode":null,"errorMessage":"跳转接口返回无效链接","messagePattern":"跳转接口返回无效链接","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/ting77/ting77.go","lineNumber":257,"sourceCode":"\t\t\tCheckRedirect: func(_ *http.Request, _ []*http.Request) error {\n\t\t\t\treturn http.ErrUseLastResponse\n\t\t\t},\n\t\t}\n\t\tresp, err := redirectClient.Do(req)\n\t\tif err != nil {\n\t\t\tlastErr = err\n\t\t\tcontinue\n\t\t}\n\t\tio.Copy(io.Discard, io.LimitReader(resp.Body, 512<<10))\n\t\tresp.Body.Close()\n\t\tlocation := strings.TrimSpace(resp.Header.Get(\"Location\"))\n\t\tif resp.StatusCode < 300 || resp.StatusCode >= 400 || location == \"\" {\n\t\t\tlastErr = fmt.Errorf(\"跳转接口返回状态码 %d\", resp.StatusCode)\n\t\t\tcontinue\n\t\t}\n\t\tresolved, err := url.Parse(location)\n\t\tif err != nil || resolved.Scheme == \"\" || resolved.Host == \"\" {\n\t\t\tlastErr = fmt.Errorf(\"跳转接口返回无效链接\")\n\t\t\tcontinue\n\t\t}\n\t\tlinkType := detectLinkType(location)\n\t\tif linkType == \"others\" {\n\t\t\tlastErr = fmt.Errorf(\"跳转接口返回不支持的链接: %s\", resolved.Host)\n\t\t\tcontinue\n\t\t}\n\t\tlink := model.Link{\n\t\t\tType:      linkType,\n\t\t\tURL:       location,\n\t\t\tPassword:  extractPassword(location),\n\t\t\tDatetime:  entry.Datetime,\n\t\t\tWorkTitle: entry.Title,\n\t\t}\n\t\tp.linkCache.Store(cacheKey, link)\n\t\treturn link, nil\n\t}\n\treturn model.Link{}, lastErr","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/ting77/ting77.go#L239-L275","documentation":"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.","triggerScenarios":"Thrown at plugin/ting77/ting77.go:257 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Resolve relative Locations against the request URL before validating","Skip entries whose redirect target stays malformed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"beaa56133755a548ebc51b090b3816e2ae044aa6","analyzedAt":"2026-09-07T00:31:18.025Z","contentChangedAt":"2026-09-07T00:31:18.025Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}