CA-280679: Fixed issue where the TabPage plugin could not handle Ipv6 addresses.

Signed-off-by: Konstantina Chremmou <konstantina.chremmou@citrix.com>
This commit is contained in:
Konstantina Chremmou 2018-01-26 17:27:16 +00:00 committed by Mihaela Stoica
parent 1febd6f49a
commit 19de8c54b5
2 changed files with 11 additions and 1 deletions

View File

@ -35,6 +35,7 @@ using System.Text.RegularExpressions;
using XenCenterLib;
using XenAdmin.XenSearch;
using XenAPI;
using System.Net.Sockets;
namespace XenAdmin.Plugins
{
@ -191,7 +192,14 @@ namespace XenAdmin.Plugins
return new List<Uri> { new Uri(u) };
}
return ips.ConvertAll(ip => new Uri(u.Replace(string.Format(PlaceholderFormat, ipAddressName), ip.ToString())));
return ips.ConvertAll(ip =>
{
var ipstring = ip.AddressIP != null && ip.AddressIP.AddressFamily == AddressFamily.InterNetworkV6
? string.Format("[{0}]", ip)
: ip.ToString();
return new Uri(u.Replace(string.Format(PlaceholderFormat, ipAddressName), ipstring));
});
}
catch (UriFormatException)
{

View File

@ -69,6 +69,8 @@ namespace XenCenterLib
get { return partialIP != null; }
}
public IPAddress AddressIP { get { return addressIP; } }
public static bool TryParse(String candidate, bool allowPartialIP, bool allowName, out ComparableAddress address)
{
address = null;