{"record":{"id":"8c34bc58382bd129","repo":"siyuan-note/siyuan","slug":"boot-appearance-path-is-too-deep-or-long","errorCode":null,"errorMessage":"boot appearance path is too deep or long","messagePattern":"boot appearance path is too deep or long","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"kernel/model/boot_appearance.go","lineNumber":535,"sourceCode":"\t}\n\tvar totalSize int64\n\tentryCount := 0\n\terr = filepath.WalkDir(appearanceDir, func(filePath string, entry os.DirEntry, walkErr error) error {\n\t\tif walkErr != nil {\n\t\t\treturn walkErr\n\t\t}\n\t\trelativePath, relativeErr := filepath.Rel(appearanceDir, filePath)\n\t\tif relativeErr != nil {\n\t\t\treturn ErrBootAppearanceAssetForbidden\n\t\t}\n\t\tif relativePath != \".\" {\n\t\t\tentryCount++\n\t\t\tif entryCount > maxBootAppearanceEntries {\n\t\t\t\treturn errors.New(\"too many boot appearance entries\")\n\t\t\t}\n\t\t\tif len(relativePath) > maxBootAppearancePathLength ||\n\t\t\t\tlen(strings.Split(filepath.ToSlash(relativePath), \"/\")) > maxBootAppearancePathDepth {\n\t\t\t\treturn errors.New(\"boot appearance path is too deep or long\")\n\t\t\t}\n\t\t}\n\t\tif entry.Type()&os.ModeSymlink != 0 {\n\t\t\treturn ErrBootAppearanceAssetForbidden\n\t\t}\n\t\tif entry.IsDir() {\n\t\t\treturn nil\n\t\t}\n\t\tinfo, infoErr := entry.Info()\n\t\tif infoErr != nil || !info.Mode().IsRegular() {\n\t\t\treturn ErrBootAppearanceAssetForbidden\n\t\t}\n\t\ttotalSize += info.Size()\n\t\tif totalSize > maxBootAppearanceTotalSize {\n\t\t\treturn errors.New(\"boot appearance package is too large\")\n\t\t}\n\t\treturn nil\n\t})","sourceCodeStart":517,"sourceCodeEnd":553,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/9f775e8a12daef8255556097396f9b2739078892/kernel/model/boot_appearance.go#L517-L553","documentation":"During the same package walk as the entry-count limit, each entry's relative path is checked against maxBootAppearancePathLength (character count) and maxBootAppearancePathDepth (slash-separated segment count). Exceeding either aborts with this error, guarding against filesystem limits and path-abuse archives.","triggerScenarios":"A boot appearance package containing a file or directory whose path is longer than maxBootAppearancePathLength characters or nested deeper than maxBootAppearancePathDepth segments (e.g. assets/a/b/c/d/e/.../img.png).","commonSituations":"Packaging export artifacts with long generated hashes in filenames; deeply nested source trees archived as-is; archives built on filesystems permitting longer paths than the target platform.","solutions":["Flatten or rename the offending paths so they are shorter and shallower, then repackage","Move deeply nested assets up to a shallow directory such as assets/","Shorten long hashed or descriptive filenames to concise names"],"exampleFix":"// before\nassets/themes/dark/2026/09/backgrounds/generated/final-banner-abc123def456.png\n// after\nassets/banner.png","handlingStrategy":"validation","validationCode":"function pathsWithinLimit(files, maxLen, maxDepth) {\n  return files.every(p => p.length <= maxLen && p.split(\"/\").length <= maxDepth);\n}","typeGuard":null,"tryCatchPattern":"try {\n  await installBootAppearance(zipPath);\n} catch (e) {\n  if (String(e).includes(\"too deep or long\")) {\n    // flatten paths and repackage\n  }\n}","preventionTips":["Keep assets in shallow directories like assets/","Avoid long hashed filenames","Check the deepest path length before packaging"],"tags":["boot-appearance","package-limits","path-length"],"backgroundTag":"value-out-of-range","analyzedSha":"9f775e8a12daef8255556097396f9b2739078892","analyzedAt":"2026-09-19T03:17:15.984Z","contentChangedAt":"2026-09-19T03:17:15.984Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}