mirror of
https://gitlab.archlinux.org/archlinux/aurweb.git
synced 2025-02-03 10:43:03 +01:00
git-serve: Support cloning with simplified paths
This commit adds support for cloning repositories over SSH without a leading slash or with a trailing .git Fixes FS#45260 Signed-off-by: Johannes Löthberg <johannes@kyriasis.com> Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
This commit is contained in:
parent
a32b83f200
commit
3158e038c8
1 changed files with 4 additions and 2 deletions
|
@ -123,8 +123,10 @@ if action == 'git-upload-pack' or action == 'git-receive-pack':
|
||||||
die_with_help("%s: missing path" % (action))
|
die_with_help("%s: missing path" % (action))
|
||||||
|
|
||||||
path = cmdargv[1].rstrip('/')
|
path = cmdargv[1].rstrip('/')
|
||||||
if not path.startswith('/') or not path.endswith('.git'):
|
if not path.startswith('/'):
|
||||||
die('%s: invalid path: %s' % (action, path))
|
path = '/' + path
|
||||||
|
if not path.endswith('.git'):
|
||||||
|
path = path + '.git'
|
||||||
pkgbase = path[1:-4]
|
pkgbase = path[1:-4]
|
||||||
if not re.match(repo_regex, pkgbase):
|
if not re.match(repo_regex, pkgbase):
|
||||||
die('%s: invalid repository name: %s' % (action, pkgbase))
|
die('%s: invalid repository name: %s' % (action, pkgbase))
|
||||||
|
|
Loading…
Add table
Reference in a new issue