We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 0725d88 commit 46365d4Copy full SHA for 46365d4
library/utils/web.py
@@ -639,9 +639,11 @@ def construct_absolute_url(base_url, href):
639
return href
640
641
if not up.netloc:
642
- if not base_url.endswith("/") and not href.startswith("/"):
643
- base_url += "/"
644
-
+ base_parsed = urlparse(base_url)
+ path = base_parsed.path
+ if not path.endswith("/") and path != "":
645
+ path = path.rsplit("/", 1)[0] + "/"
646
+ base_url = base_parsed._replace(path=path).geturl()
647
href = urljoin(base_url, href)
648
649
if href.startswith("//"):
0 commit comments