From 11567dfbad7390ec2ad7f45083a0d94aa0857b0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= Date: Fri, 13 May 2022 11:25:47 +0200 Subject: [PATCH] pull/sync: correctly query with remote-ns as parent MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit else (grand)-parents and siblings/cousins of remote-ns are also included, and mapping the remote-ns prefix fails. Signed-off-by: Fabian Grünbichler --- src/server/pull.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/server/pull.rs b/src/server/pull.rs index 87153e06..8e1381f4 100644 --- a/src/server/pull.rs +++ b/src/server/pull.rs @@ -752,11 +752,16 @@ async fn query_namespaces( "api2/json/admin/datastore/{}/namespace", params.source.store() ); - let data = params - .max_depth - .map(|max_depth| json!({ "max-depth": max_depth })); + let mut data = json!({}); + if let Some(max_depth) = params.max_depth { + data["max-depth"] = json!(max_depth); + } - let mut result = match client.get(&path, data).await { + if !params.remote_ns.is_root() { + data["parent"] = json!(params.remote_ns); + } + + let mut result = match client.get(&path, Some(data)).await { Ok(res) => res, Err(err) => match err.downcast_ref::() { Some(HttpError { code, message }) => match *code {