forked from TrueCloudLab/rclone
ftp: attempt to work-around pureftp sending spurious 150 messages
pureftpd has a bug where it sends messages like this ``` 150-Accepted data connection\r\n Response code: File status okay; about to open data connection (150) Response arg: Accepted data connection 150 32768.0 kbytes to download\r\n 150 0.014 seconds (measured here), 1665.27 Mbytes per second\r\n ``` The last `150` is treated as a new response - the previous `150` should have been `150-`. This means that rclone sees the `150 0.014 seconds (measured here), 1665.27 Mbytes per second` as a reply to the next message and reports it as an error. This fix ignores that specific message when it is received in the `Close` method. It dumps the FTP connection after as it is out of sync. See: #3984 Fixes #3445
This commit is contained in:
parent
bae2644667
commit
7d70eb0346
1 changed files with 3 additions and 1 deletions
|
@ -799,10 +799,12 @@ func (f *ftpReadCloser) Close() error {
|
|||
f.f.putFtpConnection(&f.c, nil)
|
||||
}
|
||||
// mask the error if it was caused by a premature close
|
||||
// NB StatusAboutToSend is to work around a bug in pureftpd
|
||||
// See: https://github.com/rclone/rclone/issues/3445#issuecomment-521654257
|
||||
switch errX := err.(type) {
|
||||
case *textproto.Error:
|
||||
switch errX.Code {
|
||||
case ftp.StatusTransfertAborted, ftp.StatusFileUnavailable:
|
||||
case ftp.StatusTransfertAborted, ftp.StatusFileUnavailable, ftp.StatusAboutToSend:
|
||||
err = nil
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue