Skip to content

Commit 31c6497

Browse files
committed
Fix issue when a URL is incorrectly parsed.
This patch fixes #269. Indeed, while using urllib.parse.urlpase, the hostname may be a NoneType. Therefore, the following exception has been raised by other subsystem that try to lookup the IP of hte hostname. TypeError: <self.subject> should be <class 'str'>, <class 'NoneType'> given. This patch fixes it by double checking if a NoneType is sent for DNS resolution. Contributors: * @T145
1 parent 6c98103 commit 31c6497

File tree

1 file changed

+5
-3
lines changed
  • PyFunceble/query/requests/adapter

1 file changed

+5
-3
lines changed

PyFunceble/query/requests/adapter/base.py

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -176,6 +176,8 @@ def resolve(self, hostname: str) -> Optional[str]:
176176
Resolves with the prefered method.
177177
"""
178178

179-
if self.resolving_use_cache:
180-
return self.resolve_with_cache(hostname)
181-
return self.resolve_without_cache(hostname)
179+
if hostname:
180+
if self.resolving_use_cache:
181+
return self.resolve_with_cache(hostname)
182+
return self.resolve_without_cache(hostname)
183+
return None

0 commit comments

Comments
 (0)