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
This commit is contained in:
ed 2025-09-13 21:09:59 +00:00
parent 3e97a77784
commit 14b7e5143f

View file

@ -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)