Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
# Normalise links
return os.path.normpath(path)
+ def page_exists(self, path):
+ page = self.get_page(path)
+
+ # Page must have been found and not deleted
+ return page and not page.was_deleted()
+
def get_page_title(self, page, default=None):
# Try to retrieve title from cache
title = self.memcache.get("wiki:title:%s" % page)
# If the page does not exist, we send 404
if not page or page.was_deleted():
+ # Handle /start links which were in the format of DokuWiki
+ if path.endswith("/start"):
+ # Strip /start from path
+ path = path[:-6] or "/"
+
+ # Redirect user to page if it exists
+ page = self.backend.wiki.page_exists(path)
+ if page:
+ self.redirect(path)
+
raise tornado.web.HTTPError(404)
# Fetch the latest revision