httpd: Try lowercase READMEs as well
This commit is contained in:
parent
8d5299fe85
commit
3f592e23d4
|
|
@ -420,7 +420,7 @@ async fn readme_handler(
|
||||||
) -> impl IntoResponse {
|
) -> impl IntoResponse {
|
||||||
let storage = &ctx.profile.storage;
|
let storage = &ctx.profile.storage;
|
||||||
let repo = Repository::open(paths::repository(storage, &project))?;
|
let repo = Repository::open(paths::repository(storage, &project))?;
|
||||||
let paths = &[
|
let paths = [
|
||||||
"README",
|
"README",
|
||||||
"README.md",
|
"README.md",
|
||||||
"README.markdown",
|
"README.markdown",
|
||||||
|
|
@ -429,9 +429,13 @@ async fn readme_handler(
|
||||||
"Readme.md",
|
"Readme.md",
|
||||||
];
|
];
|
||||||
|
|
||||||
for path in paths {
|
for path in paths
|
||||||
if let Ok(blob) = repo.blob(sha, path) {
|
.iter()
|
||||||
let response = api::json::blob(&blob, path);
|
.map(ToString::to_string)
|
||||||
|
.chain(paths.iter().map(|p| p.to_lowercase()))
|
||||||
|
{
|
||||||
|
if let Ok(blob) = repo.blob(sha, &path) {
|
||||||
|
let response = api::json::blob(&blob, &path);
|
||||||
return Ok::<_, Error>(Json(response));
|
return Ok::<_, Error>(Json(response));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue