mirror of
https://github.com/Prowlarr/Prowlarr
synced 2026-01-08 08:42:30 +01:00
Fixed: Error when trying to parse the value 'Unknown' as an IP Address
This commit is contained in:
parent
1032d8b3ab
commit
f062fafe82
1 changed files with 2 additions and 1 deletions
|
|
@ -164,9 +164,10 @@ public static string GetRemoteIP(this HttpRequest request)
|
|||
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…
Reference in a new issue