Merge pull request 'Convert Infaliable Result into Option and handle' (#90) from 89_fix-warning-with-handling-infaliable-result-in-fileserv-rs into main

Reviewed-on: LibreTunes/LibreTunes#90
This commit is contained in:
Ethan Girouard 2024-09-16 01:44:52 +00:00
commit 266bba05aa

View File

@ -29,11 +29,11 @@ cfg_if! { if #[cfg(feature = "ssr")] {
let req = Request::builder().uri(uri.clone()).body(Body::empty()).unwrap();
// `ServeDir` implements `tower::Service` so we can call it with `tower::ServiceExt::oneshot`
// This path is relative to the cargo root
match ServeDir::new(root).oneshot(req).await {
Ok(res) => Ok(res.into_response()),
Err(err) => Err((
match ServeDir::new(root).oneshot(req).await.ok() {
Some(res) => Ok(res.into_response()),
None => Err((
StatusCode::INTERNAL_SERVER_ERROR,
format!("Something went wrong: {err}"),
format!("Something went wrong"),
)),
}
}