]> git.proxmox.com Git - pve-http-server.git/commitdiff
multipart upload: fix upload of files starting with newlines
authorMatthias Heiserer <m.heiserer@proxmox.com>
Mon, 12 Dec 2022 15:07:54 +0000 (16:07 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Tue, 13 Dec 2022 12:16:19 +0000 (13:16 +0100)
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 <m.heiserer@proxmox.com>
Reviewed-by: Daniel Tschlatscher <d.tschlatscher@proxmox.com>
Tested-by:  Daniel Tschlatscher <d.tschlatscher@proxmox.com>
src/PVE/APIServer/AnyEvent.pm

index f397a8cd172d90b666cfe83cd8664ec1a7d75713..545c122b04d00755270be4857105a9689a5f84bd 100644 (file)
@@ -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);