{"record":{"id":"912cdc61993008e9","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-912cdc","errorCode":null,"errorMessage":"市场主题 {} 的来源地址协议无效","messagePattern":"市场主题 (.+?) 的来源地址协议无效","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_market.rs","lineNumber":230,"sourceCode":"    ] {\n        if value.trim().is_empty() || value.len() > limit {\n            bail!(\"市场主题 {} 的{}无效\", theme.id, label);\n        }\n    }\n    if theme.description.len() > 500 || theme.tags.len() > 12 {\n        bail!(\"市场主题 {} 的描述或标签数量超过限制\", theme.id);\n    }\n    if theme\n        .tags\n        .iter()\n        .any(|tag| tag.trim().is_empty() || tag.len() > 32)\n    {\n        bail!(\"市场主题 {} 包含无效标签\", theme.id);\n    }\n    let source = reqwest::Url::parse(&theme.source_url)\n        .with_context(|| format!(\"市场主题 {} 的来源地址无效\", theme.id))?;\n    if !matches!(source.scheme(), \"http\" | \"https\") {\n        bail!(\"市场主题 {} 的来源地址协议无效\", theme.id);\n    }\n    for path in [&theme.theme, &theme.image, &theme.preview] {\n        validate_market_path(path)?;\n    }\n    validate_sha256(&theme.theme_sha256)?;\n    validate_sha256(&theme.image_sha256)?;\n    Ok(())\n}\n\nfn market_http_client() -> anyhow::Result<reqwest::Client> {\n    Ok(reqwest::Client::builder()\n        .user_agent(format!(\n            \"CodexPlusPlus-Themes/{}\",\n            env!(\"CARGO_PKG_VERSION\")\n        ))\n        .connect_timeout(Duration::from_secs(8))\n        .timeout(Duration::from_secs(30))\n        .build()?)","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_market.rs#L212-L248","documentation":"While validating a market theme manifest entry, `validate_market_theme` parses the theme's `source_url` and rejects it if the URL scheme is not exactly `http` or `https`. The library throws this to enforce that theme source links point at a fetchable web resource, blocking schemes like `ftp`, `file`, or `data:` that could be unsafe or unsupported by the download client.","triggerScenarios":"A manifest theme whose `source_url` parses as a valid URL but has a scheme other than http/https (e.g. `ftp://host/theme.zip`, `file:///path`, `data:text/plain,...`). Raised by `validate_market_theme`, which is called from `install_market_theme_from_base` and `validate_manifest` (i.e. both when loading the market index and when installing a theme).","commonSituations":"Manifest authors hand-editing JSON and typing a wrong scheme; a market server serving themes whose `source_url` uses a custom/internal scheme; copying an `ftp://` or local-file link as the source; typos like `htttp://` that still parse as a URL with an unknown scheme.","solutions":["Fix the theme's `source_url` in the market manifest so it starts with `https://` (preferred) or `http://`.","If you control the market server, re-publish the manifest with corrected source URLs and refresh the market index.","If you maintain a cached copy, delete the market cache file in the state dir (`dream-skin/market` cache) so a fresh manifest is fetched after the fix.","If you believe the scheme is legitimate (e.g. an internal mirror), the upstream code must be extended to allowlist that scheme in the `matches!(source.scheme(), \"http\" | \"https\")` check."],"exampleFix":"// manifest theme entry\n// before\n\"source_url\": \"ftp://themes.example.com/skin-v1.zip\"\n// after\n\"source_url\": \"https://themes.example.com/skin-v1.zip\"","handlingStrategy":"validation","validationCode":"fn has_web_scheme(url: &str) -> bool {\n    reqwest::Url::parse(url)\n        .map(|u| matches!(u.scheme(), \"http\" | \"https\"))\n        .unwrap_or(false)\n}\n// before installing: assert!(has_web_scheme(&theme.source_url));","typeGuard":"fn is_http_url(s: &str) -> bool {\n    matches!(reqwest::Url::parse(s).ok().as_ref().map(|u| u.scheme()), Some(\"http\") | Some(\"https\"))\n}","tryCatchPattern":"match install_market_theme_from_base(...).await {\n    Err(e) if e.to_string().contains(\"协议无效\") => eprintln!(\"theme source_url must be http(s): {e}\"),\n    Err(e) => eprintln!(\"install failed: {e}\"),\n    Ok(_) => {}\n}","preventionTips":["Always author manifest source_url fields as full https:// URLs","Run the same scheme check on manifests before publishing them to the market","Never paste file:// or ftp:// links into source_url fields","Add a lint/CI step that validates every manifest URL parses with an http(s) scheme"],"tags":["validation","url","manifest","rust"],"backgroundTag":"invalid-url-format","analyzedSha":"b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6","analyzedAt":"2026-09-19T23:35:21.129Z","contentChangedAt":"2026-09-19T23:35:21.129Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}