From: Michael Tremer Date: Wed, 20 Dec 2023 15:03:37 +0000 (+0000) Subject: wiki: Find other embedded files other than images X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=ca493e119d489c2f8403ad26e125c070b31ff08e;p=ipfire.org.git wiki: Find other embedded files other than images Signed-off-by: Michael Tremer --- diff --git a/src/backend/wiki.py b/src/backend/wiki.py index 66b867fd..9bd19eca 100644 --- a/src/backend/wiki.py +++ b/src/backend/wiki.py @@ -791,7 +791,10 @@ class WikiRenderer(misc.Object): # Make the URL absolute url = self.backend.wiki.make_path(self.path, url) - files.append(url) + # Check if this is a file (it could also just be a page) + file = self.backend.wiki.get_file_by_path(url) + if file: + files.append(url) return files @@ -834,6 +837,12 @@ class LinkedFilesExtractor(markdown.treeprocessors.Treeprocessor): self.md.files.append(src) + # Find all links + for link in root.findall(".//a"): + href = link.get("href") + + self.md.files.append(href) + class LinkedFilesExtractorExtension(markdown.extensions.Extension): def extendMarkdown(self, md):