fix: cannot get file at root

This commit is contained in:
Pakin 2026-01-09 11:36:50 +07:00
parent 59d0dd7ab4
commit 2dd165b451

View file

@ -41,8 +41,19 @@ async fn checkout_handler(State(state): State<AppState>, Query(param): Query<Che
Json(json!(response))
);
}
match param.path.as_str() {
legit_path if param.path.contains("/") || state.check_country_existed(param.path.as_str()) || param.path.is_empty() => {
let legit_path = param.path.as_str();
// match param.path.as_str() {
// legit_path if param.path.contains("/") || state.check_country_existed(param.path.as_str()) || param.path.is_empty() => {
// }
// _ => {
// let error_log = "requested path is unexpected";
// error!("{error_log}");
// response.insert("error".to_string(), json!(error_log));
// }
// }
let rpath = repo_path.unwrap().clone();
let repo = match Repository::open_bare(rpath) {
Ok(repo) => repo,
@ -83,17 +94,14 @@ async fn checkout_handler(State(state): State<AppState>, Query(param): Query<Che
let error_log = "not obj nor tree";
error!("{error_log}");
response.insert("error".to_string(), json!(error_log));
}
}
_ => {
let error_log = "requested path is unexpected";
error!("{error_log}");
response.insert("error".to_string(), json!(error_log));
}
return (
axum::http::StatusCode::BAD_REQUEST,
Json(json!(response))
)
}
(
axum::http::StatusCode::BAD_REQUEST,
axum::http::StatusCode::OK,
Json(json!(response))
)
}