File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -34,15 +34,21 @@ const stripGitHubFromGitPath = (url: string): string | undefined => {
3434 */
3535const validGitRequest = ( url : string , headers : any ) : boolean => {
3636 const { 'user-agent' : agent , accept } = headers ;
37+ if ( ! agent ) {
38+ return false ;
39+ }
3740 if ( [ '/info/refs?service=git-upload-pack' , '/info/refs?service=git-receive-pack' ] . includes ( url ) ) {
3841 // https://www.git-scm.com/docs/http-protocol#_discovering_references
3942 // We can only filter based on User-Agent since the Accept header is not
4043 // sent in this request
4144 return agent . startsWith ( 'git/' ) ;
4245 }
4346 if ( [ '/git-upload-pack' , '/git-receive-pack' ] . includes ( url ) ) {
47+ if ( ! accept ) {
48+ return false ;
49+ }
4450 // 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-' ) ;
4652 }
4753 return false ;
4854} ;
You can’t perform that action at this time.
0 commit comments