From 390e81a0ab197a4dd023102e3e6351896cc4e09f Mon Sep 17 00:00:00 2001 From: joshdutchik <77994722+jdutchik@users.noreply.github.com> Date: Sun, 23 Apr 2023 18:27:56 -0500 Subject: [PATCH] 339 Bug Fix for Invalid Domain Name --- lib/location.py | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/lib/location.py b/lib/location.py index 7b36e79..a0cbfa0 100644 --- a/lib/location.py +++ b/lib/location.py @@ -391,12 +391,17 @@ def location_processing(location, ip_addr): if location and location.lstrip('~ ').startswith('@'): try: - location, region, country = _get_location( - socket.gethostbyname( - location.lstrip('~ ')[1:])) - location = '~' + location - location = _fully_qualified_location(location, region, country) - hide_full_address = not force_show_full_address + if (location.lstrip('~ ')[1:] == ""): + location, region, country = NOT_FOUND_LOCATION, None, None + + else: + location, region, country = _get_location( + socket.gethostbyname( + location.lstrip('~ ')[1:])) + location = '~' + location + location = _fully_qualified_location(location, region, country) + hide_full_address = not force_show_full_address + except: location, region, country = NOT_FOUND_LOCATION, None, None