@@ -15,9 +15,8 @@ public class Configuration : IConfiguration
15
15
public const string DefaultSessionEndpoint = "https://sessions.bugsnag.com" ;
16
16
public const string HubEndpoint = "https://notify.insighthub.smartbear.com" ;
17
17
public const string HubSessionEndpoint = "https://sessions.insighthub.smartbear.com" ;
18
- private static readonly Regex HubKeyRegex = new Regex (
19
- @"^0{5}[0-9a-fA-F]{27}$" ,
20
- RegexOptions . Compiled ) ;
18
+ private const string HubKeyPrefix = "00000" ;
19
+
21
20
22
21
public Configuration ( ) : this ( string . Empty )
23
22
{
@@ -28,8 +27,7 @@ public Configuration(string apiKey)
28
27
{
29
28
ApiKey = apiKey ;
30
29
31
- // Choose the correct hosts first-time-round
32
- bool isHubKey = IsHubApiKey ( apiKey ) ;
30
+ bool isHubKey = IsHubKey ( apiKey ) ;
33
31
Endpoint = new Uri ( isHubKey ? HubEndpoint : DefaultEndpoint ) ;
34
32
SessionEndpoint = new Uri ( isHubKey ? HubSessionEndpoint : DefaultSessionEndpoint ) ;
35
33
@@ -74,7 +72,8 @@ public Configuration(string apiKey)
74
72
75
73
public int MaximumBreadcrumbs { get ; set ; }
76
74
77
- private static bool IsHubApiKey ( string key ) =>
78
- ! string . IsNullOrWhiteSpace ( key ) && HubKeyRegex . IsMatch ( key ) ;
75
+ private static bool IsHubKey ( string key ) =>
76
+ ! string . IsNullOrEmpty ( key ) &&
77
+ key . StartsWith ( HubKeyPrefix , StringComparison . OrdinalIgnoreCase ) ;
79
78
}
80
79
}
0 commit comments