From 18c7f9be69393ed2ca2990ad639a0859b6fb9830 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 15 2016 11:53:24 +0000 Subject: Prevent project creation if the project name has exactly 40 chars after the / --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index b15dfc0..5c7e22b 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -963,6 +963,13 @@ def new_project(session, user, name, blacklist, 'conflicts in URLs with pagure itself' % name ) + second_part = name.partition('/')[2] + if len(second_part) == 40: + raise pagure.exceptions.PagureException( + 'Your project name cannot have exactly 40 characters after ' + 'the `/`' + ) + gitrepo = os.path.join(gitfolder, '%s.git' % name) if os.path.exists(gitrepo): raise pagure.exceptions.RepoExistsException(