aboutsummaryrefslogtreecommitdiffstats
path: root/server/src
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2024-01-24 20:34:13 +0100
committerLibravatar Rutger Broekhoff2024-01-24 20:34:13 +0100
commit73b5e2fee5e9490ec146b05322b45c7d8bb9ee46 (patch)
treec7cff2c7ba8c32b2951b8ac5b67f2f7df39465ec /server/src
parentc3d692ac5130a5c6f2ab0d89beb22c3b981630e2 (diff)
downloadgitolfs3-73b5e2fee5e9490ec146b05322b45c7d8bb9ee46.tar.gz
gitolfs3-73b5e2fee5e9490ec146b05322b45c7d8bb9ee46.zip
Properly handle private repos
Diffstat (limited to 'server/src')
-rw-r--r--server/src/main.rs10
1 files changed, 6 insertions, 4 deletions
diff --git a/server/src/main.rs b/server/src/main.rs
index 0f12c8f..2df42dd 100644
--- a/server/src/main.rs
+++ b/server/src/main.rs
@@ -740,6 +740,7 @@ fn forwarded_from_trusted_host(
740 } 740 }
741 Ok(false) 741 Ok(false)
742} 742}
743
743const REPO_NOT_FOUND: GitLfsErrorResponse = 744const REPO_NOT_FOUND: GitLfsErrorResponse =
744 make_error_resp(StatusCode::NOT_FOUND, "Repository not found"); 745 make_error_resp(StatusCode::NOT_FOUND, "Repository not found");
745 746
@@ -796,10 +797,11 @@ fn is_repo_public(name: &str) -> Option<bool> {
796 if !repo_exists(name) { 797 if !repo_exists(name) {
797 return None; 798 return None;
798 } 799 }
799 std::fs::metadata(format!("{name}/git-daemon-export-ok")) 800 match std::fs::metadata(format!("{name}/git-daemon-export-ok")) {
800 .ok()? 801 Ok(metadata) if metadata.is_file() => Some(true),
801 .is_file() 802 Err(e) if e.kind() == std::io::ErrorKind::NotFound => Some(false),
802 .into() 803 _ => None,
804 }
803} 805}
804 806
805async fn batch( 807async fn batch(