This repository was archived by the owner on Jun 21, 2023. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -71,10 +71,10 @@ async Task<Repository> GetRepositoryInternal()
7171 }
7272 }
7373 // it'll throw if it's private or an enterprise instance requiring authentication
74- catch ( ApiException )
74+ catch ( ApiException apiex )
7575 {
7676 if ( ! HostAddress . IsGitHubDotComUri ( OriginalUrl . ToRepositoryUrl ( ) ) )
77- isEnterprise = true ;
77+ isEnterprise = apiex . HttpResponse ? . Headers . ContainsKey ( "X-GitHub-Request-Id" ) ;
7878 }
7979 catch { }
8080 finally
Original file line number Diff line number Diff line change @@ -37,12 +37,18 @@ public async Task<EnterpriseProbeResult> ProbeAsync(Uri enterpriseBaseUrl)
3737 } ;
3838 request . Headers . Add ( "User-Agent" , productHeader . ToString ( ) ) ;
3939
40+ var success = false ;
4041 var ret = await httpClient
4142 . Send ( request , CancellationToken . None )
42- . Catch ( ex => null ) ;
43+ . Catch ( ex => {
44+ var apiex = ex as ApiException ;
45+ if ( apiex != null )
46+ success = apiex . HttpResponse ? . Headers . ContainsKey ( "X-GitHub-Request-Id" ) ?? false ;
47+ return null ;
48+ } ) ;
4349
4450 if ( ret == null )
45- return EnterpriseProbeResult . Failed ;
51+ return success ? EnterpriseProbeResult . Ok : EnterpriseProbeResult . Failed ;
4652 else if ( ret . StatusCode == HttpStatusCode . OK )
4753 return EnterpriseProbeResult . Ok ;
4854 return EnterpriseProbeResult . NotFound ;
You can’t perform that action at this time.
0 commit comments