MCPcopy Create free account
hub / github.com/Graphify-Labs/graphify / _sanitize_metadata_string

Function _sanitize_metadata_string

graphify/security.py:474–480  ·  view source on GitHub ↗

Return a control-character-free, HTML-escaped, bounded string.

(value: object)

Source from the content-addressed store, hash-verified

472
473
474def _sanitize_metadata_string(value: object) -> str:
475 """Return a control-character-free, HTML-escaped, bounded string."""
476 text = _CONTROL_CHAR_RE.sub("", str(value))
477 text = html.escape(text, quote=True)
478 if len(text) > _METADATA_MAX_VALUE_LEN:
479 text = text[:_METADATA_MAX_VALUE_LEN]
480 return text # html is imported at module level (line 5)
481
482
483def _sanitize_metadata_value(value: object) -> object:

Calls

no outgoing calls