aboutsummaryrefslogtreecommitdiff
path: root/planetwars-server/src/modules
diff options
context:
space:
mode:
authorIlion Beyst <ilion.beyst@gmail.com>2022-06-30 20:28:37 +0200
committerIlion Beyst <ilion.beyst@gmail.com>2022-06-30 20:28:37 +0200
commit4d1c0a3289a295ea27eea51ec0a91c4229a92edc (patch)
tree1810f8b8267210029bea53db4141fd7c0a0848b6 /planetwars-server/src/modules
parentd7e4a1fd5cb1ab7438d281de6dfe26013623dc6b (diff)
downloadplanetwars.dev-4d1c0a3289a295ea27eea51ec0a91c4229a92edc.tar.xz
planetwars.dev-4d1c0a3289a295ea27eea51ec0a91c4229a92edc.zip
make sure that all pushed data is actually written
Diffstat (limited to 'planetwars-server/src/modules')
-rw-r--r--planetwars-server/src/modules/registry.rs9
1 files changed, 5 insertions, 4 deletions
diff --git a/planetwars-server/src/modules/registry.rs b/planetwars-server/src/modules/registry.rs
index 346f5d9..7adb764 100644
--- a/planetwars-server/src/modules/registry.rs
+++ b/planetwars-server/src/modules/registry.rs
@@ -227,8 +227,8 @@ async fn patch_upload(
.await
.unwrap();
while let Some(Ok(chunk)) = stream.next().await {
- let n_bytes = file.write(&chunk).await.unwrap();
- len += n_bytes;
+ file.write_all(&chunk).await.unwrap();
+ len += chunk.len();
}
Ok(Response::builder()
@@ -270,9 +270,10 @@ async fn put_upload(
.unwrap();
while let Some(Ok(chunk)) = stream.next().await {
- let n_bytes = file.write(&chunk).await.unwrap();
- _len += n_bytes;
+ file.write_all(&chunk).await.unwrap();
+ _len += chunk.len();
}
+
let digest = params.digest.strip_prefix("sha256:").unwrap();
// TODO: check the digest
let target_path = PathBuf::from(REGISTRY_PATH).join("sha256").join(&digest);