about summary refs log tree commit diff
path: root/tvix/castore/src
diff options
context:
space:
mode:
authorYureka <tvl@yuka.dev>2024-07-19T10·35+0200
committerclbot <clbot@tvl.fyi>2024-07-19T10·55+0000
commit3c160731ed82484d2aaec29ba2364153a7cbe9c8 (patch)
tree0d0492e6ec96fb019c2f25144193d890bf5b16ae /tvix/castore/src
parentf0b0a6572ff7908c890963f6462af27dcef80bd7 (diff)
fix(tvix/castore/blob/object_store): empty chunk list for single chunk r/8370
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
Diffstat (limited to 'tvix/castore/src')
-rw-r--r--tvix/castore/src/blobservice/object_store.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/tvix/castore/src/blobservice/object_store.rs b/tvix/castore/src/blobservice/object_store.rs
index 224ebae9e2c6..846f3643761d 100644
--- a/tvix/castore/src/blobservice/object_store.rs
+++ b/tvix/castore/src/blobservice/object_store.rs
@@ -349,6 +349,15 @@ async fn chunk_and_upload<R: AsyncRead + Unpin>(
         .collect::<io::Result<Vec<ChunkMeta>>>()
         .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 {
         chunks,
         bao: "".into(), // still todo