{"record":{"id":"7ce1c1e8168d0fed","repo":"fish2018/pansou","slug":"error-7ce1c1","errorCode":null,"errorMessage":"站点地址不能包含路径","messagePattern":"站点地址不能包含路径","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/gying/gying.go","lineNumber":618,"sourceCode":"\tif !strings.HasPrefix(baseURL, \"http://\") && !strings.HasPrefix(baseURL, \"https://\") {\n\t\tbaseURL = \"https://\" + baseURL\n\t}\n\n\tparsed, err := url.Parse(baseURL)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"站点地址格式错误: %v\", err)\n\t}\n\tif parsed.Scheme != \"http\" && parsed.Scheme != \"https\" {\n\t\treturn \"\", fmt.Errorf(\"站点地址必须以 http:// 或 https:// 开头\")\n\t}\n\tif parsed.Host == \"\" {\n\t\treturn \"\", fmt.Errorf(\"站点地址缺少域名\")\n\t}\n\tif parsed.RawQuery != \"\" || parsed.Fragment != \"\" {\n\t\treturn \"\", fmt.Errorf(\"站点地址不能包含参数或锚点\")\n\t}\n\tif parsed.Path != \"\" && parsed.Path != \"/\" {\n\t\treturn \"\", fmt.Errorf(\"站点地址不能包含路径\")\n\t}\n\n\t// HTTP clients do not consistently convert Unicode hostnames to IDNA.\n\t// Store the ASCII form so both the config page and requests are reliable.\n\thostname, err := idna.Lookup.ToASCII(parsed.Hostname())\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"站点域名格式错误: %v\", err)\n\t}\n\thost := hostname\n\tif port := parsed.Port(); port != \"\" {\n\t\thost += \":\" + port\n\t}\n\treturn parsed.Scheme + \"://\" + host, nil\n}\n\nfunc isLegacyGyingBaseURL(baseURL string) bool {\n\tparsed, err := url.Parse(baseURL)\n\tif err != nil {","sourceCodeStart":600,"sourceCodeEnd":636,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/gying/gying.go#L600-L636","documentation":"Thrown by the same URL validator at plugin/gying.go:618 when the parsed site address has a non-empty path (anything other than \"/\"). The plugin only accepts the site origin; any path suffix means the user entered a deep link rather than the site base.","triggerScenarios":"Setting the base URL to https://example.com/forum or https://example.com/index.html; pasting a specific page URL from the site into the config.","commonSituations":"Users copy the URL of a specific forum page or index page instead of the site's root domain when filling in the plugin's site-address setting.","solutions":["Strip the path so only the origin remains (https://example.com).","If the actual API lives under a subpath, verify the plugin's expected base form; it wants the bare origin only.","Re-save config and reload the plugin."],"exampleFix":"// before\np.saveConfig(\"https://example.com/forum\")\n// after\np.saveConfig(\"https://example.com\")","handlingStrategy":"validation","validationCode":"u, err := url.Parse(siteURL)\nif err == nil && u.Path != \"\" && u.Path != \"/\" { return fmt.Errorf(\"strip the path: use %s://%s\", u.Scheme, u.Host) }","typeGuard":"func hasNoPath(raw string) bool {\n\tu, err := url.Parse(raw)\n\treturn err == nil && (u.Path == \"\" || u.Path == \"/\")\n}","tryCatchPattern":"baseURL, err := normalizeSiteURL(input)\nif err != nil {\n\treturn fmt.Errorf(\"site address rejected: %w\", err)\n}","preventionTips":["Enter the domain root, not a deep link, in the site-address field.","Trim any path in a pre-save normalization step (url.Parse then rebuild origin)."],"tags":["config","url","validation"],"backgroundTag":"invalid-url","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"}