MCPcopy Create free account
hub / github.com/cifertech/DisplayKit / resolve_icon_file

Function resolve_icon_file

server/icon_export.py:77–87  ·  view source on GitHub ↗
(static_root: Path, rel_file: str)

Source from the content-addressed store, hash-verified

75
76
77def resolve_icon_file(static_root: Path, rel_file: str) -> Path:
78 rel = rel_file.replace("\\", "/").lstrip("/")
79 if not rel or ".." in rel.split("/"):
80 raise ValueError("invalid icon path")
81 icons_root = (static_root / "icons").resolve()
82 full = (icons_root / rel).resolve()
83 try:
84 full.relative_to(icons_root)
85 except ValueError as e:
86 raise ValueError("icon path escapes icons directory") from e
87 return full
88
89
90def load_rgba_resized(path: Path, tw: int, th: int) -> tuple[int, int, bytes]:

Callers 1

export_iconsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected