{"record":{"id":"8564659ca48df6b0","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-856465","errorCode":null,"errorMessage":"无效的主题市场相对路径","messagePattern":"无效的主题市场相对路径","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_market.rs","lineNumber":350,"sourceCode":"\nfn market_asset_url(base_url: &str, relative: &str) -> anyhow::Result<String> {\n    validate_market_path(relative)?;\n    let base = reqwest::Url::parse(base_url).context(\"主题市场基础地址无效\")?;\n    let joined = base.join(relative).context(\"主题市场资源地址无效\")?;\n    if joined.scheme() != base.scheme() || joined.host_str() != base.host_str() {\n        bail!(\"主题市场资源地址越界\");\n    }\n    Ok(joined.to_string())\n}\n\nfn validate_market_path(value: &str) -> anyhow::Result<()> {\n    if value.is_empty()\n        || value.len() > 256\n        || value.starts_with('/')\n        || value.contains('\\\\')\n        || value.contains(['?', '#', '\\0'])\n    {\n        bail!(\"无效的主题市场相对路径\");\n    }\n    for segment in value.split('/') {\n        if segment.is_empty()\n            || matches!(segment, \".\" | \"..\")\n            || !segment\n                .bytes()\n                .all(|byte| byte.is_ascii_alphanumeric() || matches!(byte, b'-' | b'_' | b'.'))\n        {\n            bail!(\"无效的主题市场相对路径\");\n        }\n    }\n    Ok(())\n}\n\nfn valid_theme_id(value: &str) -> bool {\n    let bytes = value.as_bytes();\n    (1..=64).contains(&bytes.len())\n        && bytes[0].is_ascii_alphanumeric()","sourceCodeStart":332,"sourceCodeEnd":368,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_market.rs#L332-L368","documentation":"`validate_market_path` enforces the shape of relative asset paths used in market manifests: non-empty, at most 256 bytes, no leading `/`, no backslashes, and no `?`, `#`, or NUL characters. Any violation aborts with this error before the path is ever joined to the base URL or used on the filesystem. The first bail covers the whole-string rules; the second (line 359) covers per-segment rules.","triggerScenarios":"`validate_market_theme` (via `install_market_theme_from_base`/`validate_manifest`) or `market_asset_url` calls `validate_market_path` with a string that is empty, longer than 256 bytes, starts with `/`, contains `\\`, or contains `?`, `#`, or `\\0` — e.g. absolute paths, Windows-style separators, or URLs with query strings pasted into path fields.","commonSituations":"Manifest authors pasting full URLs (`assets/img.png?v=2`) into relative path fields; Windows-authored manifests using `assets\\skin.png`; leading-slash paths like `/assets/skin.png`; empty `preview` fields for themes without a preview image.","solutions":["Rewrite the manifest path fields as clean relative paths: no leading slash, forward slashes only, no query strings or fragments (e.g. `assets/skin.png`).","If a theme has no preview/image, check whether the schema permits omission rather than an empty string; otherwise supply a valid relative path.","Keep paths under 256 bytes; shorten overly long directory/file names on the server.","Re-fetch or re-publish the manifest after fixing, and clear the stale cache in the state dir."],"exampleFix":"// manifest theme entry\n// before\n\"image\": \"/assets/skin.png?v=2\"\n// after\n\"image\": \"assets/skin.png\"","handlingStrategy":"validation","validationCode":"fn plausible_rel_path(p: &str) -> bool {\n    !p.is_empty() && p.len() <= 256\n        && !p.starts_with('/')\n        && !p.contains('\\\\')\n        && !p.contains(['?', '#', '\\0'])\n}","typeGuard":"fn as_rel_path(s: &str) -> Option<&str> {\n    (!s.is_empty() && s.len() <= 256 && !s.starts_with('/') && !s.contains('\\\\') && !s.contains(['?', '#', '\\0'])).then_some(s)\n}","tryCatchPattern":"match install_market_theme_from_base(...).await {\n    Err(e) if e.to_string().contains(\"相对路径\") => {\n        eprintln!(\"manifest path field malformed; fix the market manifest\");\n    }\n    other => other?,\n}","preventionTips":["Author asset fields as pure relative paths with forward slashes only","Strip query strings/fragments before writing URLs into manifest path fields","Use a forward-slash-safe (non-Windows-shell) editing pipeline for manifests","Omit or fill optional preview fields with valid paths rather than empty strings"],"tags":["validation","path","manifest","rust"],"backgroundTag":"invalid-argument-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"}