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).
This commit is contained in:
@@ -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 ---------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user