]> git.ipfire.org Git - ipfire.org.git/blobdiff - src/backend/wiki.py
wiki: Fix link handling
[ipfire.org.git] / src / backend / wiki.py
index e3275c2a3472b8a1e5b724bd9451d066f33a2cc4..bc779fdc907655ea227fa635540b3141313f23fe 100644 (file)
@@ -500,10 +500,19 @@ class WikiRenderer(misc.Object):
        def _render_wiki_link(self, m):
                path, alias = m.groups()
 
-               # Allow relative links
-               if not path.startswith("/"):
+               # Nothing to do for absolute links
+               if path.startswith("/"):
+                       pass
+
+               # Relative links (one-level down)
+               elif path.startswith("./"):
                        path = os.path.join(self.path, path)
 
+               # All other relative links
+               else:
+                       p = os.path.dirname(self.path)
+                       path = os.path.join(p, path)
+
                # Normalise links
                path = os.path.normpath(path)