From ee7fe2963fa7a1ccbe1a4d7ce0b173d2c9181020 Mon Sep 17 00:00:00 2001 From: blek Date: Thu, 14 Dec 2023 19:37:18 +1000 Subject: [PATCH] fix compile warnings --- filed/src/web/api/files/delete.rs | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/filed/src/web/api/files/delete.rs b/filed/src/web/api/files/delete.rs index 05da341..3ed354b 100644 --- a/filed/src/web/api/files/delete.rs +++ b/filed/src/web/api/files/delete.rs @@ -1,4 +1,4 @@ -use std::{collections::HashMap, net::IpAddr}; +use std::net::IpAddr; use serde_json::json; use warp::{reply::{Reply, json, with_status}, reject::Rejection, Filter, http::StatusCode}; @@ -105,7 +105,22 @@ pub async fn delete(state: SharedState, body: DeleteFunctionPayload, ip: Option< ) } - file.delete(state).await; + let res = file.delete(state).await; + if let Err(err) = res { + return Ok( + Box::new( + with_status( + json( + &ErrorMessage { + error: Error::APIError, + details: Some(format!("Couldn't delete file: {}", err)) + } + ), + StatusCode::INTERNAL_SERVER_ERROR + ) + ) + ) + } Ok(Box::new(json(&json!({})))) }