Mercurial > libervia-web
changeset 1476:c669b5bfb8a0
pages: fix args range in `getURL` + use `urljoin`:
`urljoin` is used to have more adapter `/` management, and avoid a trailing one
author | Goffi <goffi@goffi.org> |
---|---|
date | Wed, 20 Oct 2021 17:17:21 +0200 |
parents | 83cd4862b134 |
children | b28025a7cc28 |
files | libervia/server/pages.py |
diffstat | 1 files changed, 2 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/libervia/server/pages.py Wed Oct 20 17:15:40 2021 +0200 +++ b/libervia/server/pages.py Wed Oct 20 17:17:21 2021 +0200 @@ -682,13 +682,13 @@ # we check for redirection redirect_data = self.pages_redirects[self.name] args_hash = tuple(args) - for limit in range(len(args) + 1): + for limit in range(len(args), -1, -1): current_hash = args_hash[:limit] if current_hash in redirect_data: url_base = redirect_data[current_hash] remaining = args[limit:] remaining_url = "/".join(remaining) - url = os.path.join("/", url_base, remaining_url) + url = urllib.parse.urljoin(url_base, remaining_url) break else: url = os.path.join(self.url, *url_args)