routes: fix constant 404s due to new werkzeug handling of /

This commit is contained in:
Lephe 2022-11-15 11:03:36 +01:00
parent 760c2f20b2
commit 2b9ab64f6e
Signed by: Lephenixnoir
GPG Key ID: 1BBA026E13FC0495
1 changed files with 4 additions and 2 deletions

View File

@ -25,9 +25,10 @@ from slugify import slugify
class ForumConverter(BaseConverter):
# This regex will decide which portion of the URL is matched by the curtom
# converter. By default, slashes are not included, so we must add them.
# This regex will decide which portion of the URL is converted.
regex = r'[a-z/]+'
# Allow slashes to be matched by the regex (this is not by default)
part_isolating = False
def to_python(self, url):
url = '/' + url
@ -44,6 +45,7 @@ class PageConverter(BaseConverter):
# Matches integers for the topic number, then either nothing, a page
# number, a slug, or a page number followed by a slug
regex = r'(\d+)(?:/(\d+)|/fin)?(?:/[\w-]+)?'
part_isolating = False
object = None
get_title = lambda o: "empty-title"