fix compile warnings

This commit is contained in:
blek 2023-12-14 19:37:18 +10:00
parent 589ff7b040
commit 67b670e072
Signed by: blek
GPG Key ID: 14546221E3595D0C
1 changed files with 17 additions and 2 deletions

View File

@ -1,4 +1,4 @@
use std::{collections::HashMap, net::IpAddr}; use std::net::IpAddr;
use serde_json::json; use serde_json::json;
use warp::{reply::{Reply, json, with_status}, reject::Rejection, Filter, http::StatusCode}; 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!({})))) Ok(Box::new(json(&json!({}))))
} }