MCPcopy Create free account
hub / github.com/danielmiessler/Fabric / sanitize_input_content

Function sanitize_input_content

scripts/python_ui/streamlit.py:771–796  ·  view source on GitHub ↗

Sanitize input content by removing or replacing problematic characters. Args: input_text: The input text to sanitize Returns: str: Sanitized input text

(input_text: str)

Source from the content-addressed store, hash-verified

769
770
771def sanitize_input_content(input_text: str) -> str:
772 """Sanitize input content by removing or replacing problematic characters.
773
774 Args:
775 input_text: The input text to sanitize
776
777 Returns:
778 str: Sanitized input text
779 """
780 # Remove null bytes
781 text = input_text.replace("\0", "")
782
783 # Replace control characters with spaces (except newlines and tabs)
784 allowed_chars = {"\n", "\t", "\r"}
785 sanitized_chars = []
786 for c in text:
787 if c in allowed_chars or ord(c) >= 32:
788 sanitized_chars.append(c)
789 else:
790 sanitized_chars.append(" ")
791
792 # Join characters and normalize whitespace
793 text = "".join(sanitized_chars)
794 text = " ".join(text.split())
795
796 return text
797
798
799def execute_patterns(

Callers 2

execute_patternsFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected