{"record":{"id":"edb830a9333a3bcf","repo":"siyuan-note/siyuan","slug":"invalid-style-w","errorCode":null,"errorMessage":"invalid style: %w","messagePattern":"invalid style: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/boot_appearance.go","lineNumber":448,"sourceCode":"\tif manifest.OfficialUI.ShowLogo != nil {\n\t\tret.OfficialUI.ShowLogo = *manifest.OfficialUI.ShowLogo\n\t}\n\tif manifest.OfficialUI.ShowDetails != nil {\n\t\tret.OfficialUI.ShowDetails = *manifest.OfficialUI.ShowDetails\n\t}\n\tfor _, color := range []string{manifest.OfficialUI.TextColor, manifest.OfficialUI.ProgressColor,\n\t\tmanifest.OfficialUI.TrackColor} {\n\t\tif err = validateOptionalBootAppearanceColor(color); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t}\n\tret.OfficialUI.TextColor = manifest.OfficialUI.TextColor\n\tret.OfficialUI.ProgressColor = manifest.OfficialUI.ProgressColor\n\tret.OfficialUI.TrackColor = manifest.OfficialUI.TrackColor\n\n\tif manifest.Style != \"\" {\n\t\tif _, _, err = validateBootAppearanceResource(pluginDir, appearanceDir, manifest.Style, \"style\"); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid style: %w\", err)\n\t\t}\n\t\tret.Style = bootAppearanceAssetURL(pkg.Name, appearanceID, manifest.Style)\n\t}\n\n\tlayerIDs := map[string]bool{}\n\tfor _, layer := range manifest.Layers {\n\t\tif layer == nil || !isValidBootAppearanceID(layer.ID) || layerIDs[layer.ID] {\n\t\t\terr = errors.New(\"invalid or duplicate layer ID\")\n\t\t\treturn nil, err\n\t\t}\n\t\tlayerIDs[layer.ID] = true\n\t\tif layer.Type != \"image\" && layer.Type != \"video\" {\n\t\t\terr = fmt.Errorf(\"unsupported layer type [%s]\", layer.Type)\n\t\t\treturn nil, err\n\t\t}\n\t\tif _, _, err = validateBootAppearanceResource(pluginDir, appearanceDir, layer.Src, layer.Type); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"invalid layer source: %w\", err)\n\t\t}","sourceCodeStart":430,"sourceCodeEnd":466,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/8641553a1f07374001902d3ce773285db1292b2d/kernel/model/boot_appearance.go#L430-L466","documentation":"When manifest.Style is non-empty, loadBootAppearance validates the CSS file via validateBootAppearanceResource (safe relative path, no symlink, exists, regular file, .css extension, size cap, valid UTF-8). Any failure is wrapped as \"invalid style\". This guards the style sheet that is injected into the boot screen.","triggerScenarios":"GetBootAppearances/getBootAppearanceByID loading a manifest whose style field points to a missing file, a non-.css extension, an absolute or traversal path (../), a symlink, an oversized CSS file, or a file that is not valid UTF-8 / contains NUL bytes.","commonSituations":"manifest.json references style.css but only styles.css exists (typo); style path written as '/assets/style.css' or '../style.css'; style.css saved as UTF-16 or with a BOM/NUL; CSS file above the size cap; style field points to an image by mistake.","solutions":["Check the style value in manifest.json matches the actual CSS filename inside the appearance directory (case-sensitive)","Use a relative path without leading slash, '..' segments, or backslashes, e.g. 'style.css' or 'assets/style.css'","Re-save the CSS as UTF-8 without NUL bytes and shrink it below maxBootAppearanceStyleSize","Replace any symlink in the appearance directory with a real file"],"exampleFix":"// before (manifest.json)\n{\"style\": \"/boot/style.css\"}\n// after\n{\"style\": \"style.css\"}  // file exists at appearances/<id>/style.css","handlingStrategy":"validation","validationCode":"function checkStylePath(style) {\n  if (!style) return null;\n  if (style.startsWith(\"/\") || style.includes(\"..\") || style.includes(\"\\\\\")) throw new Error(\"style path must be relative\");\n  if (!style.toLowerCase().endsWith(\".css\")) throw new Error(\"style must be a .css file\");\n}\n// plus: confirm the file exists and is UTF-8 before packaging","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Reference the style with a plain relative filename like \"style.css\"","Save CSS as UTF-8 without BOM or NUL bytes","Ship the CSS file inside the appearance directory; never symlink","Keep CSS below the kernel's maxBootAppearanceStyleSize"],"tags":["validation","css","plugin","path"],"backgroundTag":"invalid-config-value","analyzedSha":"8641553a1f07374001902d3ce773285db1292b2d","analyzedAt":"2026-09-11T16:08:28.414Z","contentChangedAt":"2026-09-11T16:08:28.414Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}