From 2d1877c28e2e71fffde29a3fa462b14c3e5879b8 Mon Sep 17 00:00:00 2001 From: Michael Tremer Date: Thu, 30 May 2019 14:36:02 +0100 Subject: [PATCH] wiki: Fix link handling Signed-off-by: Michael Tremer --- src/backend/wiki.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/backend/wiki.py b/src/backend/wiki.py index e3275c2a..bc779fdc 100644 --- a/src/backend/wiki.py +++ b/src/backend/wiki.py @@ -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) -- 2.39.2