{"record":{"id":"f23dd58369aa9ea7","repo":"BigPizzaV3/CodexPlusPlus","slug":"name-f23dd5","errorCode":null,"errorMessage":"主题包包含不支持的文件：{name}","messagePattern":"主题包包含不支持的文件：(.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/codex-plus-core/src/dream_skin_package.rs","lineNumber":121,"sourceCode":"        let file = archive\n            .by_index(index)\n            .context(\"读取 Dream Skin ZIP 条目失败\")?;\n        let name = file.name().to_string();\n        validate_archive_entry_name(&name)?;\n        if file.encrypted() || file.is_symlink() {\n            bail!(\"主题包包含加密内容或链接：{name}\");\n        }\n        if file.is_dir() {\n            entries.push((name, None));\n            continue;\n        }\n        let base_name = name.rsplit('/').next().unwrap_or_default();\n        if base_name == \".DS_Store\" || name.starts_with(\"__MACOSX/\") {\n            entries.push((name, None));\n            continue;\n        }\n        if !ALLOWED_FILES.contains(&base_name) {\n            bail!(\"主题包包含不支持的文件：{name}\");\n        }\n        let limit = file_limit(base_name);\n        let mut content = Vec::new();\n        file.take((limit + 1) as u64)\n            .read_to_end(&mut content)\n            .context(\"读取 Dream Skin ZIP 内容失败\")?;\n        if content.is_empty() || content.len() > limit {\n            bail!(\"主题包文件 {name} 超过大小限制\");\n        }\n        unpacked = unpacked.saturating_add(content.len());\n        if unpacked > UNPACKED_LIMIT {\n            bail!(\"Dream Skin 主题包解包后超过 64 MiB 限制\");\n        }\n        entries.push((name, Some(content)));\n    }\n\n    let mut files = normalize_package_entries(entries)?;\n","sourceCodeStart":103,"sourceCodeEnd":139,"githubUrl":"https://github.com/BigPizzaV3/CodexPlusPlus/blob/b1ed92e5e4a2d74095d4b8db5af43cef7acba9c6/crates/codex-plus-core/src/dream_skin_package.rs#L103-L139","documentation":"Every non-macos-cruft entry's base filename must appear in ALLOWED_FILES. Entries with any other name (e.g. unexpected images, scripts, nested dirs' files) are rejected with the full entry name in the message. This whitelists the exact set of files a Dream Skin package may contain.","triggerScenarios":"validate_and_read_package encounters a ZIP entry whose basename is not in ALLOWED_FILES (and isn't .DS_Store or under __MACOSX/). E.g. extra `preview.jpg`, `theme.css`, or a background named `bg.png` instead of an allowed name.","commonSituations":"Theme authors adding README, preview images, or source files to the zip; renamed background image; build artifacts sneaking into the archive; wrong file naming (case differences) for allowed files.","solutions":["Remove every file from the ZIP except the allowed set (background image, manifest, LICENSE.txt, manifest.sig)","Rename the background image to an allowed name: background.webp, background.jpg, or background.png","Check filename casing matches the whitelist exactly","Rebuild the package from a clean directory containing only required files"],"exampleFix":"// before\ntheme.zip: bg.png, README.md\n// after\ntheme.zip: background.png (+ manifest/LICENSE)","handlingStrategy":"validation","validationCode":"const ALLOWED: &[&str] = &[\"background.webp\",\"background.jpg\",\"background.png\",\"manifest.json\",\"LICENSE.txt\",\"manifest.sig\"];\nfor name in entry_names {\n    let base = name.rsplit('/').next().unwrap_or_default();\n    if base != \".DS_Store\" && !name.starts_with(\"__MACOSX/\") && !ALLOWED.contains(&base) {\n        return Err(DisallowedFile(name.to_string()));\n    }\n}","typeGuard":null,"tryCatchPattern":"match validate_and_read_package(&bytes, platform) {\n    Err(e) if e.to_string().contains(\"不支持的文件\") => {\n        let name = extract_name(&e);\n        Err(UserFacingError::UnexpectedFile(name))\n    }\n    other => other,\n}","preventionTips":["Build packages from a clean directory with only whitelisted files","Add a packaging script that deletes README/preview/source files before zipping","Verify against ALLOWED_FILES in CI before publishing"],"tags":["validation","whitelist","zip"],"backgroundTag":"schema-validation-failed","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"}