{"record":{"id":"cd38b3bb9f4b362f","repo":"BigPizzaV3/CodexPlusPlus","slug":"name-cd38b3","errorCode":null,"errorMessage":"主题包背景图片内容与扩展名不一致：{name}","messagePattern":"主题包背景图片内容与扩展名不一致：(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_package.rs","lineNumber":891,"sourceCode":"            .to_string();\n        if files.insert(normalized.clone(), content).is_some() {\n            bail!(\"主题包包含重复文件：{normalized}\");\n        }\n    }\n    Ok(files)\n}\n\nfn validate_image_content(name: &str, bytes: &[u8]) -> anyhow::Result<()> {\n    let valid = match name {\n        \"background.png\" => bytes.starts_with(&[0x89, b'P', b'N', b'G', 0x0d, 0x0a, 0x1a, 0x0a]),\n        \"background.jpg\" => bytes.starts_with(&[0xff, 0xd8, 0xff]),\n        \"background.webp\" => {\n            bytes.len() >= 12 && &bytes[..4] == b\"RIFF\" && &bytes[8..12] == b\"WEBP\"\n        }\n        _ => false,\n    };\n    if !valid {\n        bail!(\"主题包背景图片内容与扩展名不一致：{name}\");\n    }\n    Ok(())\n}\n\nfn file_limit(name: &str) -> usize {\n    match name {\n        \"manifest.json\" => MANIFEST_LIMIT,\n        \"theme.json\" => THEME_LIMIT,\n        \"theme.css\" => CSS_LIMIT,\n        \"LICENSE.txt\" => LICENSE_LIMIT,\n        \"manifest.sig\" => SIGNATURE_LIMIT,\n        _ => IMAGE_LIMIT,\n    }\n}\n\nfn validate_manifest(manifest: &DreamSkinPackageManifest, platform: &str) -> anyhow::Result<()> {\n    if manifest.package_version != 1 || manifest.skin_api_version != 1 {\n        bail!(\"不支持的 Dream Skin 主题协议版本\");","sourceCodeStart":873,"sourceCodeEnd":909,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/dream_skin_package.rs#L873-L909","documentation":"Thrown by validate_image_content when the magic bytes of the packaged background image do not match its filename extension (PNG signature for background.png, JPEG 0xff d8 ff for background.jpg, RIFF....WEBP for background.webp), or the name matches none of the known backgrounds. This is a content-sniffing guard against mislabeled or disguised files; the offending input is the image entry named {name} whose bytes failed the extension check.","triggerScenarios":"Thrown at crates/codex-plus-core/src/dream_skin_package.rs:891 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["用真实格式的图片重新打包，确保扩展名与实际编码一致","用 file 命令或十六进制查看器确认图片真实格式后改回正确扩展名","重新下载未损坏的主题包"],"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-14T05:17:10.506Z"}