From 9e603e254c4571fe00e3d26e663ed97da73128e9 Mon Sep 17 00:00:00 2001 From: Dietmar Maurer Date: Mon, 23 Sep 2019 11:30:20 +0200 Subject: [PATCH] src/backup/fixed_index.rs: do not use offset for checksum --- src/backup/fixed_index.rs | 1 - src/client/http_client.rs | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backup/fixed_index.rs b/src/backup/fixed_index.rs index d2d6a957..12e534b4 100644 --- a/src/backup/fixed_index.rs +++ b/src/backup/fixed_index.rs @@ -194,7 +194,6 @@ impl FixedIndexReader { for pos in 0..self.index_length { chunk_end = ((pos+1) * self.chunk_size) as u64; let digest = self.chunk_digest(pos); - csum.update(&chunk_end.to_le_bytes()); csum.update(digest); } let csum = csum.finish(); diff --git a/src/client/http_client.rs b/src/client/http_client.rs index 20b64236..0ab92e3e 100644 --- a/src/client/http_client.rs +++ b/src/client/http_client.rs @@ -901,6 +901,7 @@ impl BackupClient { let append_chunk_path = format!("{}_index", prefix); let upload_chunk_path = format!("{}_chunk", prefix); + let is_fixed_chunk_size = prefix == "fixed"; let (upload_queue, upload_result) = Self::append_chunk_queue(h2.clone(), wid, append_chunk_path.to_owned()); @@ -933,7 +934,7 @@ impl BackupClient { let chunk_end = offset + chunk_len as u64; - csum.update(&chunk_end.to_le_bytes()); + if !is_fixed_chunk_size { csum.update(&chunk_end.to_le_bytes()); } csum.update(digest); let chunk_is_known = known_chunks.contains(digest);