File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed
mkdocs_embed_file_plugins/src Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -47,7 +47,9 @@ def search_in_file(citation_part: str, contents: str) -> str:
47
47
48
48
49
49
def search_file_in_documentation (
50
- link : Union [Path , str ], config_dir : Path , base : any
50
+ link : Union [Path , str ],
51
+ config_dir : Path ,
52
+ base : any , # type: ignore
51
53
) -> Union [Path , int ]:
52
54
file_name = os .path .basename (link )
53
55
if not file_name .endswith (".md" ):
@@ -58,7 +60,8 @@ def search_file_in_documentation(
58
60
else :
59
61
baseParent = Path (base ).parents
60
62
linksParent = Path (link ).parents
61
- # find the common parent
63
+ if (len (baseParent ) == 0 ) or (len (linksParent ) == 0 ):
64
+ return 0
62
65
linksBaseEquals = [i for i in linksParent if i in baseParent ][0 ]
63
66
relative = Path (str (link ).replace (str (linksBaseEquals ), "" ))
64
67
for p in Path (base ).rglob (f"**{ relative } " ):
You can’t perform that action at this time.
0 commit comments