When the Content-Disposition header wasn't the first, i.e. upload of
```
--XVH95dt1-A3J8mWiLCmHCW4roSC7-gBntjATBy--
Content-Type: text/plain; charset=ISO-8859-1
Content-Disposition: form-data; name="content"
```
would fail. These headers now also get ignored, as we don't use them.

Fixed upload was tested using                                                   
                                                                                
                           │
* Curl                                                                          
                                                                                
                           │
* GUI                                                                           
                                                                                
                           │
* Apache HttpClient 5

Signed-off-by: Matthias Heiserer <[email protected]>
---
 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 db89ff2..c26a439 100644
--- a/src/PVE/APIServer/AnyEvent.pm
+++ b/src/PVE/APIServer/AnyEvent.pm
@@ -1209,7 +1209,7 @@ sub file_upload_multipart {
 
        my $extract_form_disposition = sub {
            my ($name) = @_;
-           if ($hdl->{rbuf} =~ s/^${delim_re}Content-Disposition: (.*?); 
name="$name"(.*)$/$2/s) {
+           if ($hdl->{rbuf} =~ s/^${delim_re}.*?Content-Disposition: (.*?); 
name="$name"(.*)$/$2/s) {
                assert_form_disposition($1);
                $remove_until_data->($hdl);
                $hdl->{rbuf} =~ s/^(.*?)(${delim_re})/$2/s;
-- 
2.30.2



_______________________________________________
pve-devel mailing list
[email protected]
https://lists.proxmox.com/cgi-bin/mailman/listinfo/pve-devel

Reply via email to