From 0da688346d84f772e9e768955477a73cf0d20979 Mon Sep 17 00:00:00 2001 From: Stanislas Polu Date: Fri, 13 Dec 2024 20:08:01 +0100 Subject: [PATCH] core: do not error when deleting a folder that does not exist (#9377) --- core/bin/core_api.rs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/core/bin/core_api.rs b/core/bin/core_api.rs index 03a4726fb43a..c70f69446f00 100644 --- a/core/bin/core_api.rs +++ b/core/bin/core_api.rs @@ -2374,11 +2374,14 @@ async fn tables_delete( "Failed to load table", Some(e), ), - Ok(None) => error_response( - StatusCode::NOT_FOUND, - "table_not_found", - &format!("No table found for id `{}`", table_id), - None, + Ok(None) => ( + StatusCode::OK, + Json(APIResponse { + error: None, + response: Some(json!({ + "success": true, + })), + }), ), Ok(Some(table)) => { match table @@ -3029,11 +3032,14 @@ async fn folders_delete( "Failed to load folder", Some(e), ), - Ok(None) => error_response( - StatusCode::NOT_FOUND, - "folder_not_found", - &format!("No folder found for id `{}`", folder_id), - None, + Ok(None) => ( + StatusCode::OK, + Json(APIResponse { + error: None, + response: Some(json!({ + "success": true, + })), + }), ), Ok(Some(_)) => { match state