From 0bd6cd357ebe6f8c453994d5c17854a1a5d6e161 Mon Sep 17 00:00:00 2001 From: Pierre-Yves Chibon Date: Apr 24 2015 11:12:59 +0000 Subject: Drop leading and trailing slash if there is any --- diff --git a/pagure/lib/git.py b/pagure/lib/git.py index 8423efb..a82016c 100644 --- a/pagure/lib/git.py +++ b/pagure/lib/git.py @@ -715,4 +715,8 @@ def get_username(abspath): repo = os.path.abspath(os.path.join(abspath, '..')) if pagure.APP.config['FORK_FOLDER'] in repo: username = repo.split(pagure.APP.config['FORK_FOLDER'])[1] + if username.startswith('/'): + username = username[1:] + if username.endswith('/'): + username = username[:-1] return username