git-serve.py: Relax path validation

Make the terminating slash in repository URLs optional.

Signed-off-by: Lukas Fleischer <archlinux@cryptocrack.de>
This commit is contained in:
Lukas Fleischer 2015-01-02 12:20:09 +01:00
parent 289ff0c700
commit e8c48e9f4c

View file

@ -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/'):
return False
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
return re.match(repo_regex, repo)
def repo_path_get_pkgbase(path):