comparison libervia/server/server.py @ 1475:83cd4862b134

server: fix args range in checkRedirection
author Goffi <goffi@goffi.org>
date Wed, 20 Oct 2021 17:15:40 +0200
parents d6062cccd4c0
children 595e7fef41f3
comparison
equal deleted inserted replaced
1474:c36490a98817 1475:83cd4862b134
1728 @param url_path: path of the url to check 1728 @param url_path: path of the url to check
1729 @return: possibly redirected URL which should link to the same location 1729 @return: possibly redirected URL which should link to the same location
1730 """ 1730 """
1731 inv_redirections = vhost_root.inv_redirections 1731 inv_redirections = vhost_root.inv_redirections
1732 url_parts = url_path.strip("/").split("/") 1732 url_parts = url_path.strip("/").split("/")
1733 for idx in range(len(url_parts), 0, -1): 1733 for idx in range(len(url_parts), -1, -1):
1734 test_url = "/" + "/".join(url_parts[:idx]) 1734 test_url = "/" + "/".join(url_parts[:idx])
1735 if test_url in inv_redirections: 1735 if test_url in inv_redirections:
1736 rem_url = url_parts[idx:] 1736 rem_url = url_parts[idx:]
1737 return os.path.join( 1737 return os.path.join(
1738 "/", "/".join([inv_redirections[test_url]] + rem_url) 1738 "/", "/".join([inv_redirections[test_url]] + rem_url)