giampaolo / pyftpdlib

Extremely fast and scalable Python FTP server library
MIT License
1.66k stars 266 forks source link

unix curl ftp upload leads to corrupted zip file #576

Open Speedy1991 opened 2 years ago

Speedy1991 commented 2 years ago

Running a command like this on a unix shell

curl -v -T 1652654118.zip --ftp-ssl --ssl-reqd --ftp-pasv ftp://<username>:<password>@<domain>:21

leads to a corrupted zip file:

unzip -t 1652654118.zip
Archive: 1652654118.zip
End-of-central-directory signature not found. Either this file is not
a zipfile, or it constitutes one disk of a multi-part archive. In the
latter case the central directory and zipfile comment will be found on
the last disk(s) of this archive.
unzip: cannot find zipfile directory in one of 1652654118.zip or
1652654118.zip.zip, and cannot find 1652654118.zip.ZIP, period.

Try to repair it leads to:

zip -FF 1652654118.zip --out test.zip
Fix archive (-FF) - salvage what can
zip warning: Missing end (EOCDR) signature - either this archive
is not readable or the end is damaged

This happens only on unix curl's, on a mingw curl the zip file stays intact.

However, adding --limit-rate 10M to the curl command, leads to a valid zip file on unix. This only happens with pyftpdlib and works as expected with e.g. the filezillaserver - so I'm pretty sure this bug must be in the pyftpd lib.

Tested with