mirror of https://git.sr.ht/~sircmpwn/hub.sr.ht
hubsrht: Match projects case-sensitively
This commit is contained in:
parent
d637723564
commit
16dea8ac4d
|
@ -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…
Reference in New Issue