Browse Source

normalize user specified external address

Luke Pulverenti 9 years ago
parent
commit
3ac2002759
1 changed files with 13 additions and 2 deletions
  1. 13 2
      MediaBrowser.Server.Implementations/Connect/ConnectManager.cs

+ 13 - 2
MediaBrowser.Server.Implementations/Connect/ConnectManager.cs

@@ -62,6 +62,17 @@ namespace MediaBrowser.Server.Implementations.Connect
             {
             {
                 var address = _config.Configuration.WanDdns;
                 var address = _config.Configuration.WanDdns;
 
 
+                if (!string.IsNullOrWhiteSpace(address))
+                {
+                    try
+                    {
+                        address = new Uri(address).Host;
+                    }
+                    catch
+                    {
+                    }
+                }
+
                 if (string.IsNullOrWhiteSpace(address) && DiscoveredWanIpAddress != null)
                 if (string.IsNullOrWhiteSpace(address) && DiscoveredWanIpAddress != null)
                 {
                 {
                     if (DiscoveredWanIpAddress.AddressFamily == AddressFamily.InterNetworkV6)
                     if (DiscoveredWanIpAddress.AddressFamily == AddressFamily.InterNetworkV6)
@@ -237,8 +248,8 @@ namespace MediaBrowser.Server.Implementations.Connect
 
 
             var postData = new Dictionary<string, string>
             var postData = new Dictionary<string, string>
             {
             {
-                {"name", _appHost.FriendlyName}, 
-                {"url", wanApiAddress}, 
+                {"name", _appHost.FriendlyName},
+                {"url", wanApiAddress},
                 {"systemId", _appHost.SystemId}
                 {"systemId", _appHost.SystemId}
             };
             };