Skip to content
This repository has been archived by the owner on Feb 27, 2024. It is now read-only.

Commit

Permalink
fix: prevent link index out of range
Browse files Browse the repository at this point in the history
  • Loading branch information
Mara-Li committed Dec 26, 2023
1 parent 895399b commit 97e479c
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions mkdocs_embed_file_plugins/src/search_quote.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,9 +60,14 @@ def search_file_in_documentation(
else:
baseParent = Path(base).parents
linksParent = Path(link).parents
if (len(baseParent) == 0) or (len(linksParent) == 0):
linksBaseEquals = [i for i in linksParent if i in baseParent]
if (
(len(baseParent) == 0)
or (len(linksParent) == 0)
or (len(linksBaseEquals) == 0)
):
return 0
linksBaseEquals = [i for i in linksParent if i in baseParent][0]
linksBaseEquals = linksBaseEquals[0]
relative = Path(str(link).replace(str(linksBaseEquals), ""))
for p in Path(base).rglob(f"**{relative}"):
return p
Expand Down

0 comments on commit 97e479c

Please sign in to comment.