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()
71
71
}
72
72
}
73
73
// it'll throw if it's private or an enterprise instance requiring authentication
74
- catch ( ApiException )
74
+ catch ( ApiException apiex )
75
75
{
76
76
if ( ! HostAddress . IsGitHubDotComUri ( OriginalUrl . ToRepositoryUrl ( ) ) )
77
- isEnterprise = true ;
77
+ isEnterprise = apiex . HttpResponse ? . Headers . ContainsKey ( "X-GitHub-Request-Id" ) ;
78
78
}
79
79
catch { }
80
80
finally
Original file line number Diff line number Diff line change @@ -37,12 +37,18 @@ public async Task<EnterpriseProbeResult> ProbeAsync(Uri enterpriseBaseUrl)
37
37
} ;
38
38
request . Headers . Add ( "User-Agent" , productHeader . ToString ( ) ) ;
39
39
40
+ var success = false ;
40
41
var ret = await httpClient
41
42
. 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
+ } ) ;
43
49
44
50
if ( ret == null )
45
- return EnterpriseProbeResult . Failed ;
51
+ return success ? EnterpriseProbeResult . Ok : EnterpriseProbeResult . Failed ;
46
52
else if ( ret . StatusCode == HttpStatusCode . OK )
47
53
return EnterpriseProbeResult . Ok ;
48
54
return EnterpriseProbeResult . NotFound ;
You can’t perform that action at this time.
0 commit comments