MCPcopy Create free account
hub / github.com/ZyphrZero/z.ai2api_python / validate_env_source

Function validate_env_source

app/admin/config_manager.py:458–470  ·  view source on GitHub ↗
(content: str)

Source from the content-addressed store, hash-verified

456
457
458def validate_env_source(content: str) -> str:
459 normalized = content.replace("\r\n", "\n").replace("\r", "\n")
460
461 for line_number, line in enumerate(normalized.splitlines(), start=1):
462 stripped = line.strip()
463 if not stripped or stripped.startswith("#"):
464 continue
465 if not _ENV_SOURCE_LINE_PATTERN.match(line):
466 raise ValueError(
467 f"第 {line_number} 行不是合法的 KEY=VALUE 格式。"
468 )
469
470 return normalized
471
472
473def build_config_page_data(

Calls

no outgoing calls