{"record":{"id":"f2062bfbc0dce867","repo":"fish2018/pansou","slug":"v-f2062b","errorCode":null,"errorMessage":"站点域名格式错误: %v","messagePattern":"站点域名格式错误: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugin/gying/gying.go","lineNumber":625,"sourceCode":"\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 {\n\t\treturn false\n\t}\n\t_, ok := legacyGyingHosts[strings.ToLower(strings.TrimSuffix(parsed.Hostname(), \".\"))]\n\treturn ok\n}\n\nfunc (p *GyingPlugin) configPath() string {","sourceCodeStart":607,"sourceCodeEnd":643,"githubUrl":"https://github.com/fish2018/pansou/blob/beaa56133755a548ebc51b090b3816e2ae044aa6/plugin/gying/gying.go#L607-L643","documentation":"Raised at plugin/gying.go:625 after the validator parses the URL and runs idna.Lookup.ToASCII on the hostname. If the hostname cannot be converted to its ASCII (punycode) form — e.g. invalid characters, empty label, or malformed Unicode — the underlying IDNA error is wrapped in this message.","triggerScenarios":"Configuring a site address whose host contains invalid IDNA characters or malformed Unicode (e.g. underscores in a hostname, stray whitespace, invalid percent-encoding in the host like https://exa%mple.com).","commonSituations":"Typo or copy/paste artifacts in a non-ASCII domain (e.g. 中文 domains) with an invalid label; hidden zero-width characters from copying a URL from chat or a webpage.","solutions":["Read the wrapped %v detail to identify the IDNA failure (invalid character, empty label, etc.).","Clean the hostname: remove spaces, underscores, and invisible Unicode characters.","For internationalized domains, enter the properly formed Unicode domain or its punycode (xn--) form.","Re-save the plugin config."],"exampleFix":"// before\np.saveConfig(\"https://exa_mple.com\") // invalid host char\n// after\np.saveConfig(\"https://example.com\")","handlingStrategy":"validation","validationCode":"u, err := url.Parse(siteURL)\nif err != nil || u.Host == \"\" { return fmt.Errorf(\"missing or invalid host\") }\nif _, err := idna.Lookup.ToASCII(u.Hostname()); err != nil { return fmt.Errorf(\"hostname not IDNA-valid: %v\", err) }","typeGuard":"func validHostname(raw string) bool {\n\tu, err := url.Parse(raw)\n\tif err != nil || u.Host == \"\" { return false }\n\t_, err = idna.Lookup.ToASCII(u.Hostname())\n\treturn err == nil\n}","tryCatchPattern":"baseURL, err := normalizeSiteURL(input)\nif err != nil {\n\tvar de *idna.Error\n\tif errors.As(err, &de) { /* IDNA-specific hint */ }\n\treturn err\n}","preventionTips":["Avoid underscores, spaces, and stray Unicode in hostnames.","Copy international domains from a reliable source to avoid invisible characters; or pre-convert to punycode.","Validate the hostname with idna.Lookup.ToASCII before saving config."],"tags":["config","url","idna","validation"],"backgroundTag":"invalid-url-format","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"}