From c22202585d46b13e6e1a980e7f19365358bd214c Mon Sep 17 00:00:00 2001 From: "Paul Gauthier (aider)" Date: Mon, 13 Jan 2025 09:35:01 -0800 Subject: [PATCH] fix: validate line_endings parameter in InputOutput initialization --- aider/io.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/aider/io.py b/aider/io.py index b79b0e63c..140847c9e 100644 --- a/aider/io.py +++ b/aider/io.py @@ -245,6 +245,12 @@ class InputOutput: self.chat_history_file = None self.encoding = encoding + valid_line_endings = {"platform", "lf", "crlf"} + if line_endings not in valid_line_endings: + raise ValueError( + f"Invalid line_endings value: {line_endings}. " + f"Must be one of: {', '.join(valid_line_endings)}" + ) self.newline = None if line_endings == "platform" \ else "\n" if line_endings == "lf" else "\r\n" self.dry_run = dry_run