File tree Expand file tree Collapse file tree 2 files changed +44
-5
lines changed Expand file tree Collapse file tree 2 files changed +44
-5
lines changed Original file line number Diff line number Diff line change @@ -438,17 +438,24 @@ async fn call_service(
438438 }
439439 } ;
440440
441- let mut headref = parsed_url. headref . trim_start_matches ( '@' ) . to_owned ( ) ;
442- if headref. is_empty ( ) {
443- headref = "HEAD" . to_string ( ) ;
444- }
445-
446441 let remote_url = [
447442 serv. upstream_url . as_str ( ) ,
448443 parsed_url. upstream_repo . as_str ( ) ,
449444 ]
450445 . join ( "" ) ;
451446
447+ if parsed_url. pathinfo . starts_with ( "/info/lfs" ) {
448+ return Ok ( Response :: builder ( )
449+ . status ( 307 )
450+ . header ( "Location" , format ! ( "{}{}" , remote_url, parsed_url. pathinfo) )
451+ . body ( hyper:: Body :: empty ( ) ) ?) ;
452+ }
453+
454+ let mut headref = parsed_url. headref . trim_start_matches ( '@' ) . to_owned ( ) ;
455+ if headref. is_empty ( ) {
456+ headref = "HEAD" . to_string ( ) ;
457+ }
458+
452459 if !josh_proxy:: auth:: check_auth ( & remote_url, & auth, ARGS . is_present ( "require-auth" ) )
453460 . in_current_span ( )
454461 . await ?
Original file line number Diff line number Diff line change 1+ $ . $ {TESTDIR}/ setup_test_env. sh
2+ $ cd $ {TESTTMP}
3+
4+ $ git clone -q http: // localhost: 8001 / real_repo. git
5+ warning: You appear to have cloned an empty repository.
6+
7+ $ cd real_repo
8+
9+ $ git status
10+ On branch master
11+
12+ No commits yet
13+
14+ nothing to commit (create/ copy files and use " git add" to track)
15+
16+ $ curl -is http: // localhost: 8002 / real_repo. git/ info/ lfs/ objects/ batch | grep -v " date:"
17+ HTTP/ 1.1 307 Temporary Redirect\r (esc)
18+ location: http: // localhost: 8001 / real_repo. git/ info/ lfs/ objects/ batch\r (esc)
19+ content-length: 0 \r (esc)
20+ \r (esc)
21+
22+ $ curl -is http: // localhost: 8002 / real_repo. git/ info/ lfs | grep -v " date:"
23+ HTTP/ 1.1 307 Temporary Redirect\r (esc)
24+ location: http: // localhost: 8001 / real_repo. git/ info/ lfs\r (esc)
25+ content-length: 0 \r (esc)
26+ \r (esc)
27+
28+ $ curl -is http: // localhost: 8002 / real_repo. git@ refs / heads/ master:/ sub1. git/ info/ lfs | grep -v " date:"
29+ HTTP/ 1.1 307 Temporary Redirect\r (esc)
30+ location: http: // localhost: 8001 / real_repo. git/ info/ lfs\r (esc)
31+ content-length: 0 \r (esc)
32+ \r (esc)
You can’t perform that action at this time.
0 commit comments