Skip to content
6 changes: 6 additions & 0 deletions nativelink-store/src/dedup_store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -283,6 +283,12 @@ impl StoreDriver for DedupStore {
offset: u64,
length: Option<u64>,
) -> Result<(), Error> {
if is_zero_digest(key.borrow()) {
writer
.send_eof()
.err_tip(|| "Failed to send zero EOF in dedup store get_part")?;
return Ok(());
}
// Special case for if a client tries to read zero bytes.
if length == Some(0) {
writer
Expand Down
5 changes: 5 additions & 0 deletions nativelink-store/tests/dedup_store_test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,11 @@ async fn empty_cas_upload_does_not_publish_dedup_index() -> Result<(), Error> {
)?;
for digest in ZERO_BYTE_DIGESTS {
store.update_oneshot(digest, bytes::Bytes::new()).await?;
assert_eq!(store.has(digest).await?, Some(0));
assert_eq!(
store.get_part_unchunked(digest, 0, None).await?,
bytes::Bytes::new()
);
}
assert_eq!(index.len_for_test(), 0);
assert_eq!(content.len_for_test(), 0);
Expand Down
Loading