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

Function sanitize_input_content

scripts/python_ui/streamlit.py:772–797  ·  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

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

Callers 2

execute_patternsFunction · 0.85
mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected