From a286cc9d552c581d5fc0427feb36fac535935b3f Mon Sep 17 00:00:00 2001 From: ed Date: Sun, 25 Sep 2022 14:04:35 +0200 Subject: [PATCH] fix printing big unicode messages --- copyparty/httpcli.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/copyparty/httpcli.py b/copyparty/httpcli.py index deb16013..2d7f682c 100644 --- a/copyparty/httpcli.py +++ b/copyparty/httpcli.py @@ -710,7 +710,13 @@ class HttpCli(object): self.log("urlform: {} bytes, {}".format(post_sz, path)) elif "print" in opt: reader, _ = self.get_body_reader() - for buf in reader: + buf = b"" + for rbuf in reader: + buf += rbuf + if len(buf) > 32768: + break + + if buf: orig = buf.decode("utf-8", "replace") t = "urlform_raw {} @ {}\n {}\n" self.log(t.format(len(orig), self.vpath, orig))