MCPcopy Create free account
hub / github.com/FSoft-AI4Code/CodeWiki / _is_within

Function _is_within

codewiki/mcp/tools/doc_writer.py:23–29  ·  view source on GitHub ↗

Return True if *path* resolves to somewhere inside *base*.

(path: Path, base: Path)

Source from the content-addressed store, hash-verified

21
22
23def _is_within(path: Path, base: Path) -> bool:
24 """Return True if *path* resolves to somewhere inside *base*."""
25 try:
26 path.resolve().relative_to(base.resolve())
27 return True
28 except ValueError:
29 return False
30
31
32def _safe_doc_path(session: SessionState, filename: str) -> Path | None:

Callers 1

_safe_doc_pathFunction · 0.85

Calls 1

resolveMethod · 0.80

Tested by

no test coverage detected