Skip to content
This repository was archived by the owner on Jun 21, 2023. It is now read-only.

Commit 988c393

Browse files
committed
Allow enterprise urls without a scheme.
Don't insist on `https://enterprise.me`, allow `enterprise.me`. This defaults to `http` rather than `https` but there should be a redirect in place.
1 parent a61935e commit 988c393

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

src/GitHub.App/ViewModels/Dialog/LoginToGitHubForEnterpriseViewModel.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ async void EnterpriseUrlChanged(string url, bool valid)
141141

142142
try
143143
{
144-
var uri = new Uri(url);
144+
var uri = new UriBuilder(url).Uri;
145145
ProbeStatus = EnterpriseProbeStatus.Checking;
146146

147147
if (await enterpriseCapabilities.Probe(uri) == EnterpriseProbeResult.Ok)

src/GitHub.Exports.Reactive/Validation/ReactivePropertyValidator.cs

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,15 @@ public static ReactivePropertyValidator<string> IfNotUri(this ReactivePropertyVa
280280
{
281281
return This.IfFalse(s =>
282282
{
283-
Uri uri;
284-
return Uri.TryCreate(s, UriKind.Absolute, out uri);
283+
try
284+
{
285+
new UriBuilder(s);
286+
return true;
287+
}
288+
catch
289+
{
290+
return false;
291+
}
285292
}, errorMessage);
286293
}
287294

0 commit comments

Comments
 (0)