diff --git a/josh-proxy/src/bin/josh-proxy.rs b/josh-proxy/src/bin/josh-proxy.rs index 5f0ffa7f5..3e0a07e3e 100644 --- a/josh-proxy/src/bin/josh-proxy.rs +++ b/josh-proxy/src/bin/josh-proxy.rs @@ -1253,19 +1253,17 @@ async fn call_service( } pu } else { - let redirect_path = if path == "/" { - "/~/ui/".to_string() + if path == "/" { + let redirect_path = "/~/ui/".to_string(); + return Ok(Response::builder() + .status(hyper::StatusCode::FOUND) + .header("Location", redirect_path) + .body(empty())?); } else { - format!( - "/~/ui/browse?repo={}.git&path=&filter=%3A%2F&rev=HEAD", - path - ) + return Ok(Response::builder() + .status(hyper::StatusCode::NOT_FOUND) + .body(empty())?); }; - - return Ok(Response::builder() - .status(hyper::StatusCode::FOUND) - .header("Location", redirect_path) - .body(empty())?); } }; diff --git a/tests/proxy/clone_invalid_url.t b/tests/proxy/clone_invalid_url.t index b877565ca..4d14d9779 100644 --- a/tests/proxy/clone_invalid_url.t +++ b/tests/proxy/clone_invalid_url.t @@ -24,9 +24,7 @@ $ cd ${TESTTMP} $ git clone -q http://localhost:8002/xxx full_repo - fatal: unable to update url base from redirection: - asked for: http://localhost:8002/xxx/info/refs?service=git-upload-pack - redirect: http://localhost:8002/~/ui/browse?repo=/xxx/info/refs.git&path=&filter=%3A%2F&rev=HEAD + fatal: repository 'http://localhost:8002/xxx/' not found [128] $ bash ${TESTDIR}/destroy_test_env.sh diff --git a/tests/proxy/ui.t b/tests/proxy/ui.t index 333fd84f3..3e253130d 100644 --- a/tests/proxy/ui.t +++ b/tests/proxy/ui.t @@ -24,7 +24,6 @@ date: * (glob) \r (esc) $ curl -s -I http://127.0.0.1:8002/a/repo - HTTP/1.1 302 Found\r (esc) - location: /~/ui/browse?repo=/a/repo.git&path=&filter=%3A%2F&rev=HEAD\r (esc) + HTTP/1.1 404 Not Found\r (esc) date: * (glob) \r (esc)