Fix issues
This commit is contained in:
@@ -174,13 +174,21 @@ def parse_uri(uri: str):
|
||||
return host, port, path
|
||||
|
||||
|
||||
def get_uri(url: str):
|
||||
def uri_from_url(url: str):
|
||||
"""
|
||||
Returns a valid URI of the specified URL.
|
||||
"""
|
||||
parsed = urlsplit(url)
|
||||
|
||||
result = f"http://{parsed.netloc}{parsed.path}"
|
||||
if parsed.hostname is None:
|
||||
url = f"http://{url}"
|
||||
parsed = urlsplit(url)
|
||||
|
||||
path = parsed.path
|
||||
if path == "":
|
||||
path = "/"
|
||||
|
||||
result = f"http://{parsed.netloc}{path}"
|
||||
if parsed.query != "":
|
||||
result = f"{result}?{parsed.query}"
|
||||
|
||||
|
Reference in New Issue
Block a user