{"record":{"id":"d2e8bc9c561a6b5a","repo":"BigPizzaV3/CodexPlusPlus","slug":"error-d2e8bc","errorCode":null,"errorMessage":"无效的市场主题下载文件名","messagePattern":"无效的市场主题下载文件名","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_market.rs","lineNumber":326,"sourceCode":"        });\n    }\n    let records: MarketInstallRecords = serde_json::from_slice(&std::fs::read(path)?)?;\n    if records.schema_version != market_schema_version() {\n        bail!(\"不支持的主题市场安装记录版本\");\n    }\n    Ok(records)\n}\n\nfn record_market_install(state_dir: &Path, id: &str, version: &str) -> anyhow::Result<()> {\n    let mut records = read_install_records(state_dir)?;\n    records.themes.insert(id.to_string(), version.to_string());\n    let bytes = serde_json::to_vec_pretty(&records)?;\n    crate::settings::atomic_write(&state_dir.join(MARKET_INSTALLS_FILE), &bytes)\n}\n\nfn market_download_path(state_dir: &Path, id: &str, extension: &str) -> anyhow::Result<PathBuf> {\n    if !valid_theme_id(id) || !matches!(extension, \"png\" | \"jpg\" | \"gif\" | \"bmp\" | \"webp\") {\n        bail!(\"无效的市场主题下载文件名\");\n    }\n    Ok(state_dir\n        .join(\"dream-skin/market/downloads\")\n        .join(format!(\"{id}.{extension}\")))\n}\n\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()","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/dream_skin_market.rs#L308-L344","documentation":"Validation guard in market_download_path: the theme id fails valid_theme_id or the extension is not one of png/jpg/gif/bmp/webp. Because the id and extension are concatenated into a filesystem path, invalid values are refused to prevent path injection and unsupported file types.","triggerScenarios":"Thrown at crates/codex-plus-core/src/dream_skin_market.rs:326 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Ensure the theme id matches the allowed id format","Use a supported image extension (png, jpg, gif, bmp, webp)"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f2074595a281bc057525c748175c8eb9805b0673","analyzedAt":"2026-08-23T12:52:24.489Z","contentChangedAt":"2026-08-23T12:52:24.489Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}