[aur-dev] [PATCH] git-serve.py: Relax path validation

Lukas Fleischer archlinux at cryptocrack.de
Fri Jan 2 11:24:38 UTC 2015


Make the terminating slash in repository URLs optional.

Signed-off-by: Lukas Fleischer <archlinux at cryptocrack.de>
---
 scripts/git-integration/git-serve.py | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/scripts/git-integration/git-serve.py b/scripts/git-integration/git-serve.py
index 3669a73..c81887b 100755
--- a/scripts/git-integration/git-serve.py
+++ b/scripts/git-integration/git-serve.py
@@ -26,9 +26,12 @@ ssh_cmdline = config.get('serve', 'ssh-cmdline')
 def repo_path_validate(path):
     if not path.startswith(repo_base_path):
         return False
-    if not path.endswith('.git/'):
+    if path.endswith('.git'):
+        repo = path[len(repo_base_path):-4]
+    elif path.endswith('.git/'):
+        repo = path[len(repo_base_path):-5]
+    else:
         return False
-    repo = path[len(repo_base_path):-5]
     return re.match(repo_regex, repo)
 
 def repo_path_get_pkgbase(path):
-- 
2.2.1


More information about the aur-dev mailing list