Skip to content

Commit 6ce29fa

Browse files
committed
Fixed incorrect and unsafe src href link
1 parent b6a650b commit 6ce29fa

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

src/lazydocs/generation.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
from dataclasses import dataclass
1313
from pydoc import locate
1414
from typing import Any, Callable, Dict, List, Optional
15+
from urllib.parse import quote
1516

1617
_RE_BLOCKSTART_LIST = re.compile(
1718
r"^(Args:|Arg:|Arguments:|Parameters:|Kwargs:|Attributes:|Returns:|Yields:|Kwargs:|Raises:).{0,2}$",
@@ -683,7 +684,7 @@ def _get_src_path(self, obj: Any, append_base: bool = True) -> str:
683684
if append_base and self.src_base_url:
684685
relative_path = os.path.join(self.src_base_url, relative_path)
685686

686-
return relative_path
687+
return quote("/".join(relative_path.split("\\")), safe=":/#")
687688

688689
def func2md(self, func: Callable, clsname: str = "", depth: int = 3, is_mdx: bool = False) -> str:
689690
"""Takes a function (or method) and generates markdown docs.

0 commit comments

Comments
 (0)