Fixed: Error when trying to parse the value 'Unknown' as an IP Address

pull/100/head
Robin Dadswell 3 years ago committed by GitHub
parent 1032d8b3ab
commit f062fafe82
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -164,9 +164,10 @@ namespace Prowlarr.Http.Extensions
public static string GetHostName(this HttpRequest request)
{
string ip = request.GetRemoteIP();
IPAddress myIP = IPAddress.Parse(ip);
try
{
IPAddress myIP = IPAddress.Parse(ip);
IPHostEntry getIPHost = Dns.GetHostEntry(myIP);
List<string> compName = getIPHost.HostName.ToString().Split('.').ToList();
return compName.First();

Loading…
Cancel
Save