fix(tvix/castore/blob/object_store): empty chunk list for single chunk

Change-Id: Ie3609ac6184ecead11c4e03073433c26ce129848
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11981
Autosubmit: yuka <yuka@yuka.dev>
Reviewed-by: flokli <flokli@flokli.de>
Tested-by: BuildkiteCI
This commit is contained in:
Yureka 2024-07-19 12:35:09 +02:00 committed by clbot
parent f0b0a6572f
commit 3c160731ed

View file

@ -349,6 +349,15 @@ async fn chunk_and_upload<R: AsyncRead + Unpin>(
.collect::<io::Result<Vec<ChunkMeta>>>() .collect::<io::Result<Vec<ChunkMeta>>>()
.await?; .await?;
let chunks = if chunks.len() < 2 {
// The chunker returned only one chunk, which is the entire blob.
// According to the protocol, we must return an empty list of chunks
// when the blob is not split up further.
vec![]
} else {
chunks
};
let stat_blob_response = StatBlobResponse { let stat_blob_response = StatBlobResponse {
chunks, chunks,
bao: "".into(), // still todo bao: "".into(), // still todo