MCPcopy Index your code
hub / github.com/google/adk-python / _parse_file_path

Function _parse_file_path

src/google/adk/cli/fast_api.py:182–196  ·  view source on GitHub ↗
(file_path: str)

Source from the content-addressed store, hash-verified

180 return app_name, rel_path
181
182 def _parse_file_path(file_path: str) -> str:
183 file_path = _normalize_relative_path(file_path)
184 if not file_path:
185 raise ValueError("file_path is missing.")
186 if file_path.startswith("/"):
187 raise ValueError(f"Absolute file_path rejected: {file_path!r}")
188 if _has_parent_reference(file_path):
189 raise ValueError(f"Path traversal rejected: {file_path!r}")
190 ext = os.path.splitext(file_path)[1].lower()
191 if ext not in _ALLOWED_EXTENSIONS:
192 raise ValueError(
193 f"File type not allowed: {file_path!r}"
194 f" (allowed: {', '.join(sorted(_ALLOWED_EXTENSIONS))})"
195 )
196 return file_path
197
198 def _resolve_under_dir(root_dir: Path, rel_path: str) -> Path:
199 file_path = root_dir / rel_path

Callers 2

get_agent_builderMethod · 0.85
get_agent_builderFunction · 0.85

Calls 3

_normalize_relative_pathFunction · 0.85
_has_parent_referenceFunction · 0.85
joinMethod · 0.45

Tested by

no test coverage detected