fix: cannot get file at root
This commit is contained in:
parent
59d0dd7ab4
commit
2dd165b451
1 changed files with 53 additions and 45 deletions
28
src/app.rs
28
src/app.rs
|
|
@ -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))
|
||||
)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue