From 36814be447a9cdc4a1e6d39a9fe16ad335ab750a Mon Sep 17 00:00:00 2001 From: Alex Auvolat Date: Sat, 16 Jan 2021 16:05:54 +0100 Subject: [PATCH] Fix S3 ListObjects result and replace println!s by debug!s --- script/dev-cluster.sh | 2 +- src/api/api_server.rs | 4 ++-- src/api/s3_list.rs | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/script/dev-cluster.sh b/script/dev-cluster.sh index 64c17cfc..9da72909 100755 --- a/script/dev-cluster.sh +++ b/script/dev-cluster.sh @@ -10,7 +10,7 @@ PATH="${GARAGE_DEBUG}:${GARAGE_RELEASE}:$PATH" FANCYCOLORS=("41m" "42m" "44m" "45m" "100m" "104m") export RUST_BACKTRACE=1 -export RUST_LOG=garage=info +export RUST_LOG=garage=info,garage_api=debug MAIN_LABEL="\e[${FANCYCOLORS[0]}[main]\e[49m" WHICH_GARAGE=$(which garage || exit 1) diff --git a/src/api/api_server.rs b/src/api/api_server.rs index ec02572d..f0c3f31b 100644 --- a/src/api/api_server.rs +++ b/src/api/api_server.rs @@ -173,7 +173,7 @@ async fn handler_inner(garage: Arc, req: Request) -> Result { // CreateBucket // If we're here, the bucket already exists, so just answer ok - println!( + debug!( "Body: {}", std::str::from_utf8(&hyper::body::to_bytes(req.into_body()).await?) .unwrap_or("") @@ -229,7 +229,7 @@ async fn handler_inner(garage: Arc, req: Request) -> Result") diff --git a/src/api/s3_list.rs b/src/api/s3_list.rs index 599d0d11..07b87d3a 100644 --- a/src/api/s3_list.rs +++ b/src/api/s3_list.rs @@ -150,8 +150,8 @@ pub async fn handle_list( writeln!(&mut xml, "\t").unwrap(); } if result_common_prefixes.len() > 0 { - writeln!(&mut xml, "\t").unwrap(); for pfx in result_common_prefixes.iter() { + writeln!(&mut xml, "\t").unwrap(); writeln!( &mut xml, "\t\t{}", @@ -159,11 +159,11 @@ pub async fn handle_list( //xml_encode_key(pfx, urlencode_resp) ) .unwrap(); + writeln!(&mut xml, "\t").unwrap(); } - writeln!(&mut xml, "\t").unwrap(); } writeln!(&mut xml, "").unwrap(); - println!("{}", xml); + debug!("{}", xml); Ok(Response::new(Body::from(xml.into_bytes()))) }