navigation: fix parameters left in URL for parents

This commit is contained in:
dece 2021-04-17 21:52:20 +02:00
parent f3a3a36039
commit 7b9a314481

View file

@ -53,11 +53,11 @@ def set_parameter(url: str, user_input: str):
def get_parent_url(url: str) -> str:
"""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("/")
if 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: