mirror of
https://github.com/rclone/rclone.git
synced 2024-11-22 09:32:29 +08:00
crypt: fix reading 0 length files
In an earlier patch
d5afcf9e34
crypt: try not to return "unexpected EOF" error
This introduced a bug for 0 length files which this fixes which only
manifests if the io.Reader returns data and EOF which not all readers
do.
This was failing in the integration tests.
This commit is contained in:
parent
864eb89a67
commit
bb6cfe109d
|
@ -804,7 +804,7 @@ func (c *Cipher) newDecrypter(rc io.ReadCloser) (*decrypter, error) {
|
|||
if n < fileHeaderSize && err == io.EOF {
|
||||
// This read from 0..fileHeaderSize-1 bytes
|
||||
return nil, fh.finishAndClose(ErrorEncryptedFileTooShort)
|
||||
} else if err != nil {
|
||||
} else if err != io.EOF && err != nil {
|
||||
return nil, fh.finishAndClose(err)
|
||||
}
|
||||
// check the magic
|
||||
|
|
Loading…
Reference in New Issue
Block a user