mirror of
https://github.com/rclone/rclone.git
synced 2025-01-24 12:56:36 +02:00
crypt: fix reading 0 length files
In an earlier patch d5afcf9e34044e5b 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 {
|
if n < fileHeaderSize && err == io.EOF {
|
||||||
// This read from 0..fileHeaderSize-1 bytes
|
// This read from 0..fileHeaderSize-1 bytes
|
||||||
return nil, fh.finishAndClose(ErrorEncryptedFileTooShort)
|
return nil, fh.finishAndClose(ErrorEncryptedFileTooShort)
|
||||||
} else if err != nil {
|
} else if err != io.EOF && err != nil {
|
||||||
return nil, fh.finishAndClose(err)
|
return nil, fh.finishAndClose(err)
|
||||||
}
|
}
|
||||||
// check the magic
|
// check the magic
|
||||||
|
Loading…
x
Reference in New Issue
Block a user