From 16dea8ac4d6fe3e0c84e45583e91c2effba92c3d Mon Sep 17 00:00:00 2001 From: Adnan Maolood Date: Fri, 1 Jul 2022 09:57:08 -0400 Subject: [PATCH] hubsrht: Match projects case-sensitively --- hubsrht/blueprints/projects.py | 2 +- hubsrht/projects.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/hubsrht/blueprints/projects.py b/hubsrht/blueprints/projects.py index bfba1c7..7fcc607 100644 --- a/hubsrht/blueprints/projects.py +++ b/hubsrht/blueprints/projects.py @@ -183,7 +183,7 @@ def create_POST(): valid.expect(not name or name not in [".git", ".hg"], "Name must not be '.git' or '.hg'", field="name") valid.expect(not name or Project.query - .filter(Project.name.ilike(name.replace('_', '\\_'))) + .filter(Project.name == name) .filter(Project.owner_id == current_user.id).count() == 0, "Name must be unique among your projects", field="name") valid.expect(not description or len(description) < 512, diff --git a/hubsrht/projects.py b/hubsrht/projects.py index 7fafc1a..4708afb 100644 --- a/hubsrht/projects.py +++ b/hubsrht/projects.py @@ -13,7 +13,7 @@ def get_project(owner, project_name, access, user=current_user): project = (Project.query .join(User, Project.owner_id == User.id) .filter(User.username == owner) - .filter(Project.name.ilike(project_name.replace('_', '\\_'))) + .filter(Project.name == project_name) ).one_or_none() if not project: abort(404)