From 14b7e5143fd196d986ab642852236c8ac263a831 Mon Sep 17 00:00:00 2001 From: ed Date: Sat, 13 Sep 2025 21:09:59 +0000 Subject: [PATCH] md-editor: fix extra http roundtrip; the check for a leading newline was not specific enough, accidentally matching the opening line of a json document, triggering the xhr safeguard and wasting a roundtrip --- copyparty/httpcli.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index c4e70274..2f36c04c 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -4911,8 +4911,8 @@ class HttpCli(object): else: fullfile = b"" - if not sz_md and b"\n" in buf[:2]: - lead = buf[: buf.find(b"\n") + 1] + if not sz_md and buf.startswith((b"\n", b"\r\n")): + lead = b"\n" if buf.startswith(b"\n") else b"\r\n" sz_md += len(lead) sz_md += len(buf)