MCPcopy Index your code
hub / github.com/vastsa/FileCodeBox / resolve_theme_file

Function resolve_theme_file

main.py:818–828  ·  view source on GitHub ↗
(*parts: str)

Source from the content-addressed store, hash-verified

816
817
818def resolve_theme_file(*parts: str):
819 theme_root = resolve_theme_root()
820 file_path = theme_root.joinpath(*parts).resolve()
821 # 防止通过 /assets/../ 读取主题目录外的文件。
822 try:
823 file_path.relative_to(theme_root)
824 except ValueError:
825 raise HTTPException(status_code=404, detail="资源不存在")
826 if not file_path.is_file():
827 raise HTTPException(status_code=404, detail="资源不存在")
828 return file_path
829
830
831@app.get("/assets/{asset_path:path}", include_in_schema=False)

Callers 4

theme_assetFunction · 0.85
indexFunction · 0.85

Calls 1

resolve_theme_rootFunction · 0.85