Check if repo is blocked before checking auth
Change:
commit-id:cae15f45
@@ -791,6 +791,17 @@ async fn call_service(
headref = "HEAD".to_string();
}
+ if is_repo_blocked(&meta) {
+ return Ok(make_response(
+ hyper::Body::from(formatdoc!(
+ r#"
+ Access to this repo is blocked via JOSH_REPO_BLOCK
+ "#
+ )),
+ hyper::StatusCode::UNPROCESSABLE_ENTITY,
+ ));
+ }
+
let http_auth_required =
ARGS.get_flag("require-auth") && parsed_url.pathinfo == "/git-receive-pack";
@@ -808,17 +819,6 @@ async fn call_service(
return Ok(builder.body(hyper::Body::empty())?);
}
- if is_repo_blocked(&meta) {
- return Ok(make_response(
- hyper::Body::from(formatdoc!(
- r#"
- Access to this repo is blocked via JOSH_REPO_BLOCK
- "#
- )),
- hyper::StatusCode::UNPROCESSABLE_ENTITY,
- ));
- }
-
if parsed_url.api == "/~/graphql" {
return serve_graphql(serv, req, meta.config.repo.to_owned(), remote_url, auth).await;
}
