From 335b2064313da83fcd47a062ca995496a5391ffb Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 15 2016 12:58:35 +0000 Subject: Fix how we compute the list of allowed prefix, the check and the error returned --- diff --git a/pagure/lib/__init__.py b/pagure/lib/__init__.py index 45cc9ff..2683afe 100644 --- a/pagure/lib/__init__.py +++ b/pagure/lib/__init__.py @@ -964,12 +964,12 @@ def new_project(session, user, name, blacklist, allowed_prefix, ) user_obj = __get_user(session, user) - allowed_prefix += [user] + [grp.name for grp in user_obj.groups] + allowed_prefix = allowed_prefix + [user] + [grp.name for grp in user_obj.groups] first_part, _, second_part = name.partition('/') - if first_part not in allowed_prefix: + if second_part and first_part not in allowed_prefix: raise pagure.exceptions.PagureException( - 'Your project name may not start with `forks/`.' + 'The prefix of you project must be in `%s`.' % allowed_prefix ) if len(second_part) == 40: raise pagure.exceptions.PagureException(