hubsrht: Match projects case-sensitively

master 0.14.19
Adnan Maolood 3 months ago committed by Drew DeVault
parent d637723564
commit 16dea8ac4d
  1. 2
      hubsrht/blueprints/projects.py
  2. 2
      hubsrht/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,

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

Loading…
Cancel
Save