This commit is contained in:
Trinity Pointard 2021-04-06 02:54:00 +02:00
parent 47d0aee9f8
commit b3b0b20d72

View file

@ -302,8 +302,14 @@ impl BodyChunker {
if self.buf.len() == 0 {
Ok(None)
} else {
let mut iter = FastCDC::with_eof(self.buf.make_contiguous(), self.min_block_size, self.avg_block_size, self.max_block_size, self.read_all);
if let Some(Chunk {length, ..}) = iter.next() {
let mut iter = FastCDC::with_eof(
self.buf.make_contiguous(),
self.min_block_size,
self.avg_block_size,
self.max_block_size,
self.read_all,
);
if let Some(Chunk { length, .. }) = iter.next() {
let block = self.buf.drain(..length).collect::<Vec<u8>>();
Ok(Some(block))
} else {