File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -34,15 +34,21 @@ const stripGitHubFromGitPath = (url: string): string | undefined => {
34
34
*/
35
35
const validGitRequest = ( url : string , headers : any ) : boolean => {
36
36
const { 'user-agent' : agent , accept } = headers ;
37
+ if ( ! agent ) {
38
+ return false ;
39
+ }
37
40
if ( [ '/info/refs?service=git-upload-pack' , '/info/refs?service=git-receive-pack' ] . includes ( url ) ) {
38
41
// https://www.git-scm.com/docs/http-protocol#_discovering_references
39
42
// We can only filter based on User-Agent since the Accept header is not
40
43
// sent in this request
41
44
return agent . startsWith ( 'git/' ) ;
42
45
}
43
46
if ( [ '/git-upload-pack' , '/git-receive-pack' ] . includes ( url ) ) {
47
+ if ( ! accept ) {
48
+ return false ;
49
+ }
44
50
// https://www.git-scm.com/docs/http-protocol#_uploading_data
45
- return agent . startsWith ( 'git/' ) && accept . startsWith ( 'application/x-git-' ) ;
51
+ return agent . startsWith ( 'git/' ) && accept . startsWith ( 'application/x-git-' ) ;
46
52
}
47
53
return false ;
48
54
} ;
You can’t perform that action at this time.
0 commit comments