From 526697fa23e11b0ca4011a13bc6285e106543000 Mon Sep 17 00:00:00 2001 From: avichalp Date: Wed, 12 Jun 2024 01:23:16 +0800 Subject: [PATCH] Fix nested key bug Signed-off-by: avichalp --- fendermint/app/src/cmd/objects.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/fendermint/app/src/cmd/objects.rs b/fendermint/app/src/cmd/objects.rs index 89af0e11..8d4f2cd8 100644 --- a/fendermint/app/src/cmd/objects.rs +++ b/fendermint/app/src/cmd/objects.rs @@ -66,7 +66,8 @@ cmd! { .and(warp::multipart::form().max_length(MAX_OBJECT_LENGTH)) .and_then(handle_object_upload); - let objects_download = warp::path!("v1" / "objects" / Address / String) + let objects_download = warp::path!("v1" / "objects" / Address / ..) + .and(warp::path::tail()) .and( warp::get().map(|| "GET".to_string()).or(warp::head().map(|| "HEAD".to_string())).unify() @@ -613,7 +614,7 @@ struct ObjectRange { #[allow(clippy::too_many_arguments)] async fn handle_object_download( address: Address, - key: String, + tail: Tail, method: String, range: Option, height_query: HeightQuery, @@ -624,6 +625,8 @@ async fn handle_object_download( let height = height_query .height .unwrap_or(FvmQueryHeight::Committed.into()); + let path = tail.as_str(); + let key: Vec = path.into(); let maybe_object = os_get(client, args, address, GetParams { key: key.into() }, height) .await .map_err(|e| {