Visit ComfyUI Online for ready-to-use ComfyUI environment
Clean and prepare text strings for filenames by removing or replacing disallowed characters, ensuring compatibility with operating systems.
The SanitizeFilename node is designed to clean and prepare text strings for use as filenames by removing or replacing characters that are not allowed in file names. This node is particularly useful when you need to ensure that filenames are compatible with various operating systems, which often have restrictions on the characters that can be used. By sanitizing filenames, you can prevent errors that may occur when saving or accessing files with invalid names. The node operates by stripping out newline characters, removing or replacing characters such as backslashes, forward slashes, asterisks, question marks, colons, quotes, angle brackets, and pipes, and trimming any leading or trailing whitespace. This ensures that the resulting filename is clean, concise, and free from problematic characters, making it suitable for file storage and retrieval operations.
The text parameter is a string input that represents the filename you wish to sanitize. It accepts multiline text, allowing you to input filenames that may contain newline characters or other invalid characters. The function of this parameter is to provide the raw filename that needs to be cleaned up. By processing this input, the node ensures that the output is a valid filename free from characters that could cause issues when saving or accessing files. There are no specific minimum, maximum, or default values for this parameter, as it is designed to handle any string input that requires sanitization.
The sanitized_text output parameter is a string that represents the cleaned and sanitized version of the input filename. This output is crucial as it provides a filename that is free from invalid characters and ready for use in file operations. The sanitized text ensures compatibility with file systems by removing problematic characters and whitespace, thus preventing potential errors related to file naming conventions. The output is a single string that can be directly used as a valid filename.
\, /, *, ?, :, ", <, >, and |.RunComfy is the premier ComfyUI platform, offering ComfyUI online environment and services, along with ComfyUI workflows featuring stunning visuals. RunComfy also provides AI Models, enabling artists to harness the latest AI tools to create incredible art.