From 12bb0c236a1f2b0fc1c48ba9d8aa5dc88c08de0d Mon Sep 17 00:00:00 2001 From: JalonSolov Date: Tue, 15 Jun 2021 00:29:02 -0400 Subject: [PATCH] net: fix 0 length file if Content-Header is missing or corrupt (#10464) --- vlib/net/http/chunked/dechunk.v | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/vlib/net/http/chunked/dechunk.v b/vlib/net/http/chunked/dechunk.v index 0e82586e4c..446eaeb07a 100644 --- a/vlib/net/http/chunked/dechunk.v +++ b/vlib/net/http/chunked/dechunk.v @@ -68,5 +68,9 @@ pub fn decode(text string) string { cscanner.skip_crlf() } cscanner.skip_crlf() - return sb.str() + if sb.len > 0 { + return sb.str() + } else { + return text + } }