Fix cargo clippy issue
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2025-09-05 13:41:32 +02:00
parent 068284c456
commit 5bb6bdccd0
2 changed files with 17 additions and 15 deletions

View File

@@ -89,20 +89,22 @@ where
Box::pin(async move {
// Check if POST request comes from another website (block invalid origins)
let origin = req.headers().get(header::ORIGIN);
if req.method() == Method::POST && req.path() != TOKEN_URI && req.path() != USERINFO_URI
if req.method() == Method::POST
&& req.path() != TOKEN_URI
&& req.path() != USERINFO_URI
&& let Some(o) = origin
&& !o
.to_str()
.unwrap_or("bad")
.eq(&AppConfig::get().website_origin)
{
log::warn!("Blocked POST request from invalid origin! Origin given {o:?}");
return Ok(req.into_response(
HttpResponse::Unauthorized()
.body("POST request from invalid origin!")
.map_into_right_body(),
));
}
&& !o
.to_str()
.unwrap_or("bad")
.eq(&AppConfig::get().website_origin)
{
log::warn!("Blocked POST request from invalid origin! Origin given {o:?}");
return Ok(req.into_response(
HttpResponse::Unauthorized()
.body("POST request from invalid origin!")
.map_into_right_body(),
));
}
if req.path().starts_with("/.git") {
return Ok(req.into_response(