Fix stripping trailing slashes of URLs

Most URLs ending with a trailing slash currently 404, because the strict
mode is not properly disabled in the app.

The strict_slashes value must be set before adding the routes.

After this patch, requesting URLs with a trailing slash will work as
expected (eg git.sr.ht/~sircmpwn/git.sr.ht/)
This commit is contained in:
delthas 2022-04-13 14:45:02 +02:00 committed by Drew DeVault
parent 530f4839a1
commit 2a5f5783d6
1 changed files with 2 additions and 2 deletions

View File

@ -20,6 +20,8 @@ class GitApp(SrhtFlask):
super().__init__("git.sr.ht", __name__,
oauth_service=oauth_service)
self.url_map.strict_slashes = False
from gitsrht.blueprints.auth import auth
from gitsrht.blueprints.public import public
from gitsrht.blueprints.api import register_api
@ -77,8 +79,6 @@ class GitApp(SrhtFlask):
os.path.dirname(__file__), "templates"))]
self.jinja_loader = ChoiceLoader(choices)
self.url_map.strict_slashes = False
def lookup_user(self, email):
return User.query.filter(User.email == email).one_or_none()