From f1d9bdf47875006a88a3c4fa896deda70af5f9e5 Mon Sep 17 00:00:00 2001 From: cproudlock Date: Thu, 23 Jul 2026 11:42:51 -0400 Subject: [PATCH] startnet editor: harden _split_lines against doubled CRLF (\r\r\n) A CRLF file re-CRLF'd (e.g. sed adding \r to already-CRLF lines) yields \r\r\n; the old _split_lines left a stray \r that split into a blank line between every line, so parse_boot_menu/settings/lint saw a garbled file and returned nothing. Now collapse any run of CR before a newline. Also re-deployed a clean-CRLF startnet.cmd into the live boot.wim (the earlier sed-based deploys had doubled the CR). --- webapp/services/wim.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/webapp/services/wim.py b/webapp/services/wim.py index 15c1713..4dc66d9 100644 --- a/webapp/services/wim.py +++ b/webapp/services/wim.py @@ -125,7 +125,9 @@ def _split_lines(content): Rejoining with eol.join(...) reproduces a trailing newline because a trailing terminator yields a final empty element. """ - return content.replace("\r\n", "\n").replace("\r", "\n").split("\n") + # Collapse any run of CRs before a newline (handles CRLF and a doubled + # \r\r\n that a bad CRLF-conversion can leave behind), then lone CR. + return re.sub(r"\r+\n", "\n", content).replace("\r", "\n").split("\n") # --- Shared regexes ---------------------------------------------------------