{"record":{"id":"441226c02a2983dc","repo":"BigPizzaV3/CodexPlusPlus","slug":"label-sha-256","errorCode":null,"errorMessage":"{label} SHA-256 校验失败","messagePattern":"(.+?) SHA-256 校验失败","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_market.rs","lineNumber":389,"sourceCode":"        })\n}\n\nfn validate_sha256(value: &str) -> anyhow::Result<()> {\n    if value.len() != 64\n        || !value\n            .bytes()\n            .all(|byte| byte.is_ascii_digit() || (b'a'..=b'f').contains(&byte))\n    {\n        bail!(\"主题市场包含无效 SHA-256\");\n    }\n    Ok(())\n}\n\nfn verify_sha256(bytes: &[u8], expected: &str, label: &str) -> anyhow::Result<()> {\n    validate_sha256(expected)?;\n    let actual = format!(\"{:x}\", Sha256::digest(bytes));\n    if actual != expected {\n        bail!(\"{label} SHA-256 校验失败\");\n    }\n    Ok(())\n}\n\nfn detect_image_extension(bytes: &[u8]) -> Option<&'static str> {\n    if bytes.starts_with(b\"\\x89PNG\\r\\n\\x1a\\n\") {\n        Some(\"png\")\n    } else if bytes.starts_with(&[0xff, 0xd8, 0xff]) {\n        Some(\"jpg\")\n    } else if bytes.starts_with(b\"GIF87a\") || bytes.starts_with(b\"GIF89a\") {\n        Some(\"gif\")\n    } else if bytes.starts_with(b\"BM\") {\n        Some(\"bmp\")\n    } else if bytes.len() >= 12 && &bytes[..4] == b\"RIFF\" && &bytes[8..12] == b\"WEBP\" {\n        Some(\"webp\")\n    } else {\n        None\n    }","sourceCodeStart":371,"sourceCodeEnd":407,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/f2074595a281bc057525c748175c8eb9805b0673/crates/codex-plus-core/src/dream_skin_market.rs#L371-L407","documentation":"Integrity guard in verify_sha256: the downloaded content's actual SHA-256 does not equal the expected hash from the manifest. label identifies the asset (theme or image). This fires on truncated downloads, corrupted files, or a manifest pointing at different content — install is aborted before anything is written.","triggerScenarios":"Thrown at crates/codex-plus-core/src/dream_skin_market.rs:389 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Retry the download; a transient truncation may be the cause","Refresh the manifest — the asset may have been updated with a new hash","Report a persistent mismatch to the market maintainer"],"exampleFix":null,"handlingStrategy":"retry","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"}