{"record":{"id":"800c64fedd8a26b3","repo":"BigPizzaV3/CodexPlusPlus","slug":"manifest-files-mediatype","errorCode":null,"errorMessage":"manifest.files 的 mediaType 不匹配：{}","messagePattern":"manifest\\.files 的 mediaType 不匹配：(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_package.rs","lineNumber":1129,"sourceCode":"            \"manifest.json\" => manifest_bytes,\n            \"theme.json\" => theme_bytes,\n            \"theme.css\" => css_bytes,\n            path if path == image_name => image_bytes,\n            \"LICENSE.txt\" => license_bytes.context(\"manifest 声明了 LICENSE.txt 但包内缺失\")?,\n            \"manifest.sig\" => continue,\n            _ => continue,\n        };\n        let expected_media_type = match file.path.as_str() {\n            \"theme.json\" => \"application/json\",\n            \"theme.css\" => \"text/css\",\n            \"background.webp\" => \"image/webp\",\n            \"background.jpg\" => \"image/jpeg\",\n            \"background.png\" => \"image/png\",\n            \"LICENSE.txt\" => \"text/plain\",\n            _ => \"\",\n        };\n        if file.media_type != expected_media_type {\n            bail!(\"manifest.files 的 mediaType 不匹配：{}\", file.path);\n        }\n        let actual = format!(\"{:x}\", Sha256::digest(bytes));\n        if file.bytes != bytes.len() || !actual.eq_ignore_ascii_case(&file.sha256) {\n            bail!(\"manifest.files 的 SHA-256 或大小不匹配：{}\", file.path);\n        }\n    }\n    if !seen.contains(\"theme.json\") || !seen.contains(\"theme.css\") || !seen.contains(image_name) {\n        bail!(\"manifest.files 缺少必需文件\");\n    }\n    if seen.contains(\"LICENSE.txt\") != license_bytes.is_some() {\n        bail!(\"manifest.files 的 LICENSE.txt 与包内容不一致\");\n    }\n    Ok(())\n}\n\nfn valid_theme_id(value: &str) -> bool {\n    let mut chars = value.chars();\n    chars.next().is_some_and(|c| c.is_ascii_alphanumeric())","sourceCodeStart":1111,"sourceCodeEnd":1147,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/dream_skin_package.rs#L1111-L1147","documentation":"Thrown by validate_manifest_files when a file entry's mediaType does not match the hard-coded expected MIME for its path (e.g. theme.css must be text/css, background.webp must be image/webp). The offending input is the media_type declared for {file.path} in manifest.json; the metadata must agree with the fixed content model of a Dream Skin package.","triggerScenarios":"Thrown at crates/codex-plus-core/src/dream_skin_package.rs:1129 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["把 mediaType 改为该路径对应的规范 MIME 类型"],"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"}