From 216ca85b164dfcdfb9731acb0bfd6baef184e63d Mon Sep 17 00:00:00 2001 From: Drew DeVault Date: Wed, 29 Apr 2020 10:46:05 -0400 Subject: [PATCH] Allow trailing slashes on some routes --- hubsrht/app.py | 2 ++ hubsrht/blueprints/projects.py | 2 +- hubsrht/blueprints/users.py | 4 ++-- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/hubsrht/app.py b/hubsrht/app.py index bc9fe42..0a27606 100644 --- a/hubsrht/app.py +++ b/hubsrht/app.py @@ -27,4 +27,6 @@ class HubApp(SrhtFlask): self.register_blueprint(users) self.register_blueprint(webhooks) + self.url_map.strict_slashes = False + app = HubApp() diff --git a/hubsrht/blueprints/projects.py b/hubsrht/blueprints/projects.py index dfbb355..1c6b8cb 100644 --- a/hubsrht/blueprints/projects.py +++ b/hubsrht/blueprints/projects.py @@ -12,7 +12,7 @@ from srht.validation import Validation, valid_url projects = Blueprint("projects", __name__) -@projects.route("//") +@projects.route("///") def summary_GET(owner, project_name): owner, project = get_project(owner, project_name, ProjectAccess.read) diff --git a/hubsrht/blueprints/users.py b/hubsrht/blueprints/users.py index d988639..a651eca 100644 --- a/hubsrht/blueprints/users.py +++ b/hubsrht/blueprints/users.py @@ -6,7 +6,7 @@ from srht.search import search_by users = Blueprint("users", __name__) -@users.route("/~") +@users.route("/~/") def summary_GET(username): user = User.query.filter(User.username == username).first() if not user: @@ -32,7 +32,7 @@ def summary_GET(username): user=user, projects=projects, EventType=EventType, events=events, **pagination) -@users.route("/projects/") +@users.route("/projects//") def projects_GET(owner): if owner.startswith("~"): owner = owner[1:]