~edwargix/git.sr.ht

2a5f5783d60bdb476352f3087bd77ea271338822 — delthas 2 years ago 530f483
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/)
1 files changed, 2 insertions(+), 2 deletions(-)

M gitsrht/app.py
M gitsrht/app.py => gitsrht/app.py +2 -2
@@ 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()