From c7fa5ecce6a4b4766a956d46dea64f5a194ec4df Mon Sep 17 00:00:00 2001 From: "Robin H. Johnson" Date: Fri, 28 Dec 2007 03:46:05 -0800 Subject: Allow some slashes, to provide support for git+ssh:// URLs that always have a leading slash. --- gitosis/serve.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gitosis/serve.py') diff --git a/gitosis/serve.py b/gitosis/serve.py index 9718758..2d45f58 100644 --- a/gitosis/serve.py +++ b/gitosis/serve.py @@ -66,6 +66,18 @@ def serve(cfg, user, command): and verb not in COMMANDS_READONLY): raise UnknownCommandError() + if args.startswith("'/") and args.endswith("'"): + args = args[1:-1] + repos = util.getRepositoryDir(cfg) + reposreal = os.path.realpath(repos) + if args.startswith(repos): + args = os.path.realpath(args)[len(repos)+1:] + elif args.startswith(reposreal): + args = os.path.realpath(args)[len(reposreal)+1:] + else: + args = args[1:] + args = "'%s'" % (args, ) + match = ALLOW_RE.match(args) if match is None: raise UnsafeArgumentsError() -- cgit v1.2.3