navigation: fix parameters left in URL for parents
This commit is contained in:
parent
f3a3a36039
commit
7b9a314481
|
@ -53,11 +53,11 @@ def set_parameter(url: str, user_input: str):
|
||||||
|
|
||||||
def get_parent_url(url: str) -> str:
|
def get_parent_url(url: str) -> str:
|
||||||
"""Return the parent URL (one level up)."""
|
"""Return the parent URL (one level up)."""
|
||||||
scheme, netloc, path, params, query, frag = parse_url(url)
|
scheme, netloc, path, _, _, _ = parse_url(url)
|
||||||
last_slash = path.rstrip("/").rfind("/")
|
last_slash = path.rstrip("/").rfind("/")
|
||||||
if last_slash > -1:
|
if last_slash > -1:
|
||||||
path = path[:last_slash + 1]
|
path = path[:last_slash + 1]
|
||||||
return urllib.parse.urlunparse((scheme, netloc, path, params, query, frag))
|
return urllib.parse.urlunparse((scheme, netloc, path, "", "", ""))
|
||||||
|
|
||||||
|
|
||||||
def get_root_url(url: str) -> str:
|
def get_root_url(url: str) -> str:
|
||||||
|
|
Reference in a new issue