Skip to content

Commit ca6461e

Browse files
committed
refactor: Handle absence of # when computing relative URLs
1 parent 901d382 commit ca6461e

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/mkdocs_autorefs/_internal/references.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -434,7 +434,8 @@ def relative_url(url_a: str, url_b: str) -> str:
434434
The relative URL to go from A to B.
435435
"""
436436
parts_a = url_a.split("/")
437-
url_b, anchor = url_b.split("#", 1)
437+
url_b, *rest = url_b.split("#", 1)
438+
anchor = rest[0] if rest else ""
438439
parts_b = url_b.split("/")
439440

440441
# Remove common left parts.

0 commit comments

Comments
 (0)