mirror of
https://github.com/rclone/rclone.git
synced 2025-12-06 00:03:32 +00:00
crypt: add --crypt-pass-bad-blocks to allow corrupted file output
This commit is contained in:
@@ -1536,6 +1536,17 @@ func TestDecrypterRead(t *testing.T) {
|
||||
}
|
||||
file16copy[i] ^= 0xFF
|
||||
}
|
||||
|
||||
// Test that we can corrupt a byte and read zeroes if
|
||||
// passBadBlocks is set
|
||||
copy(file16copy, file16)
|
||||
file16copy[len(file16copy)-1] ^= 0xFF
|
||||
c.passBadBlocks = true
|
||||
fh, err = c.newDecrypter(io.NopCloser(bytes.NewBuffer(file16copy)))
|
||||
assert.NoError(t, err)
|
||||
buf, err := io.ReadAll(fh)
|
||||
assert.NoError(t, err)
|
||||
assert.Equal(t, make([]byte, 16), buf)
|
||||
}
|
||||
|
||||
func TestDecrypterClose(t *testing.T) {
|
||||
|
||||
Reference in New Issue
Block a user