mirror of
https://github.com/chubin/wttr.in
synced 2025-01-12 03:58:45 +00:00
339 Bug Fix for Invalid Domain Name
This commit is contained in:
parent
60e1a3bf68
commit
390e81a0ab
1 changed files with 11 additions and 6 deletions
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in a new issue