From ac6f3a6bb6c8d2490f4fa741889b18499fe90520 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Fri, 31 May 2019 08:30:18 -0400 Subject: [PATCH] fix ip address matching on getdomain --- src/App/Pages/Vault/AutofillCiphersPageViewModel.cs | 7 +++++-- src/Core/Utilities/CoreHelpers.cs | 2 +- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/App/Pages/Vault/AutofillCiphersPageViewModel.cs b/src/App/Pages/Vault/AutofillCiphersPageViewModel.cs index b69c31cb5..7a8e93292 100644 --- a/src/App/Pages/Vault/AutofillCiphersPageViewModel.cs +++ b/src/App/Pages/Vault/AutofillCiphersPageViewModel.cs @@ -63,8 +63,11 @@ namespace Bit.App.Pages { name = Uri.Substring(Constants.AndroidAppProtocol.Length); } - else if(!System.Uri.TryCreate(Uri, UriKind.Absolute, out Uri uri) || - !DomainName.TryParseBaseDomain(uri.Host, out name)) + else + { + name = CoreHelpers.GetDomain(Uri); + } + if(string.IsNullOrWhiteSpace(name)) { name = "--"; } diff --git a/src/Core/Utilities/CoreHelpers.cs b/src/Core/Utilities/CoreHelpers.cs index 30770289c..a999271da 100644 --- a/src/Core/Utilities/CoreHelpers.cs +++ b/src/Core/Utilities/CoreHelpers.cs @@ -63,7 +63,7 @@ namespace Bit.Core.Utilities return null; } - if(uri.Host == "localhost" || Regex.IsMatch(uriString, IpRegex)) + if(uri.Host == "localhost" || Regex.IsMatch(uri.Host, IpRegex)) { return uri.Host; }