From 26ea294acd1eb2721c230038839de0130f52db92 Mon Sep 17 00:00:00 2001 From: Matthias Heiserer Date: Mon, 12 Dec 2022 16:07:54 +0100 Subject: [PATCH] multipart upload: fix upload of files starting with newlines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Currently, if a file starts with a newline, it gets removed and the upload succeeds (provided no hash is given). Signed-off-by: Matthias Heiserer Reviewed-by: Daniel Tschlatscher Tested-by:  Daniel Tschlatscher --- src/PVE/APIServer/AnyEvent.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/PVE/APIServer/AnyEvent.pm b/src/PVE/APIServer/AnyEvent.pm index f397a8c..545c122 100644 --- a/src/PVE/APIServer/AnyEvent.pm +++ b/src/PVE/APIServer/AnyEvent.pm @@ -1217,7 +1217,7 @@ sub file_upload_multipart { if ($hdl->{rbuf} =~ s/^${delim_re} Content-Disposition:\ (.*?);\ name="(.*?)";\ filename="([^"]+)"${newline_re} - Content-Type:\ \S*\s+ + Content-Type:\ \S*${newline_re}{2} //sxx ) { assert_form_disposition($1);