{"record":{"id":"730c99e826f3312b","repo":"BigPizzaV3/CodexPlusPlus","slug":"manifest-files-license-txt","errorCode":null,"errorMessage":"manifest.files 的 LICENSE.txt 与包内容不一致","messagePattern":"manifest\\.files 的 LICENSE\\.txt 与包内容不一致","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_package.rs","lineNumber":1140,"sourceCode":"            \"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())\n        && value\n            .chars()\n            .all(|c| c.is_ascii_lowercase() || c.is_ascii_digit() || matches!(c, '-' | '.'))\n}\n\nfn valid_semver(value: &str) -> bool {\n    let parts = value.split('.').collect::<Vec<_>>();\n    parts.len() == 3\n        && value.len() <= 32\n        && parts.iter().all(|part| {\n            !part.is_empty()","sourceCodeStart":1122,"sourceCodeEnd":1158,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_package.rs#L1122-L1158","documentation":"validate_manifest_files checks that the set of files listed in a skin package's manifest.files exactly matches the actual archive contents for LICENSE.txt. The library throws this error when the manifest and the package disagree about whether a LICENSE.txt exists: either it is declared in the manifest but absent from the package, or present in the package but not declared. This is an integrity check to keep manifest metadata truthful.","triggerScenarios":"Calling validate_and_read_package (which runs validate_manifest_files) on a package zip where: (a) manifest.files contains a \"LICENSE.txt\" entry but the archive has no LICENSE.txt bytes (license_bytes is None), or (b) the archive contains LICENSE.txt bytes but manifest.files does not list it.","commonSituations":"Hand-editing the manifest JSON without re-zipping; removing or adding a LICENSE.txt when repackaging a skin; zipping the directory while excluding LICENSE.txt via ignore rules; template manifests copied between packages with different license files.","solutions":["Open the package archive and confirm whether LICENSE.txt actually exists in the zip.","If LICENSE.txt should exist, add it back to the archive (or re-zip the full package directory).","If LICENSE.txt should not exist, remove the \"LICENSE.txt\" entry from manifest.files.","Rebuild the package with the packaging tooling rather than hand-editing the manifest so files and manifest stay in sync.","Re-run validate_and_read_package to confirm the package passes validation."],"exampleFix":"// before: manifest declares LICENSE.txt but zip lacks it\n{ \"files\": [\"theme.json\", \"theme.css\", \"wallpaper.png\", \"LICENSE.txt\"] }\n// after: manifest matches zip contents\n{ \"files\": [\"theme.json\", \"theme.css\", \"wallpaper.png\"] }","handlingStrategy":"validation","validationCode":"let manifest_files: HashSet<&str> = manifest.files.iter().map(|f| f.as_str()).collect();\nlet has_license_in_zip = license_bytes.is_some();\nif manifest_files.contains(\"LICENSE.txt\") != has_license_in_zip {\n    return Err(\"manifest.files 与包内 LICENSE.txt 不一致\");\n}","typeGuard":"fn license_consistent(manifest_files: &[String], license_bytes: Option<&[u8]>) -> bool {\n    manifest_files.iter().any(|f| f == \"LICENSE.txt\") == license_bytes.is_some()\n}","tryCatchPattern":"match validate_and_read_package(path) {\n    Err(e) if e.to_string().contains(\"LICENSE.txt 与包内容不一致\") => fix_manifest_and_retry(path),\n    other => other,\n}","preventionTips":["Always build skin packages with the packaging tool, never hand-edit manifest.files.","After zipping, run validate_and_read_package before distribution.","Keep LICENSE.txt presence consistent across package template versions."],"tags":["skin-package","manifest","validation"],"backgroundTag":"checksum-mismatch","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"}