mirror of
https://github.com/facebook/sapling.git
synced 2024-10-08 15:57:43 +03:00
Make sure the repository names don't have slashes at the at or else in some
cases env[path_info] will not find an defined repository. REQUEST_URI can contain a query_string appending the repository name would lead to corrupt urls.
This commit is contained in:
parent
ab4559b9f1
commit
5787ac106e
@ -927,15 +927,18 @@ def server(path, name, templates, address, port, use_ipv6=False,
|
||||
# This is a stopgap
|
||||
class hgwebdir:
|
||||
def __init__(self, config):
|
||||
def cleannames(items):
|
||||
return [(name.strip('/'), path) for name, path in items]
|
||||
|
||||
if type(config) == type([]):
|
||||
self.repos = config
|
||||
self.repos = cleannames(config)
|
||||
elif type(config) == type({}):
|
||||
self.repos = config.items()
|
||||
self.repos = cleannames(config.items())
|
||||
self.repos.sort()
|
||||
else:
|
||||
cp = ConfigParser.SafeConfigParser()
|
||||
cp.read(config)
|
||||
self.repos = cp.items("paths")
|
||||
self.repos = cleannames(cp.items("paths"))
|
||||
self.repos.sort()
|
||||
|
||||
def run(self, req=hgrequest()):
|
||||
@ -956,7 +959,7 @@ class hgwebdir:
|
||||
u.readconfig(file(os.path.join(path, '.hg', 'hgrc')))
|
||||
get = u.config
|
||||
|
||||
url = ('/'.join([req.env["REQUEST_URI"], name])
|
||||
url = ('/'.join([req.env["REQUEST_URI"].split('?')[0], name])
|
||||
.replace("//", "/"))
|
||||
|
||||
yield dict(contact=get("web", "contact") or
|
||||
|
Loading…
Reference in New Issue
Block a user