mirror of
https://github.com/rclone/rclone.git
synced 2026-01-05 18:13:17 +00:00
crypt: return unexpected EOF instead of Failed to authenticate decrypted block #873
Streams which truncated early with an EOF message would return a "Failed to authenticate decrypted block" error. While technically correct, this isn't a helpful error message as it masks the underlying problem. This changes it to return "unexpected EOF" instead. The rest of rclone knows it should retry such errors.
This commit is contained in:
@@ -579,6 +579,11 @@ func (fh *decrypter) fillBuffer() (err error) {
|
||||
block := fh.buf
|
||||
_, ok := secretbox.Open(block[:0], readBuf[:n], fh.nonce.pointer(), &fh.c.dataKey)
|
||||
if !ok {
|
||||
// if block wouldn't decode and got unexpected EOF
|
||||
// then return that as it is probably a better error
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return ErrorEncryptedBadBlock
|
||||
}
|
||||
fh.bufIndex = 0
|
||||
|
||||
Reference in New Issue
Block a user