hubsrht: Match projects case-sensitively

This commit is contained in:
Adnan Maolood 2022-07-01 09:57:08 -04:00 committed by Drew DeVault
parent d637723564
commit 16dea8ac4d
2 changed files with 2 additions and 2 deletions

View File

@ -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,

View File

@ -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)