mirror of
https://github.com/facebook/sapling.git
synced 2024-10-06 23:07:18 +03:00
hgwebdir: fix incorrect index generation for invalid paths (issue2023)
8aa8db6deb47 moved the subdirectory match inside the repository match loop. A virtual path existing/path/invalid/path would then match existing/path, and generate a wrong index page.
This commit is contained in:
parent
ca7126202b
commit
e391a0d422
@ -153,10 +153,11 @@ class hgwebdir(object):
|
||||
# nested indexes and hgwebs
|
||||
|
||||
repos = dict(self.repos)
|
||||
while virtual:
|
||||
real = repos.get(virtual)
|
||||
virtualrepo = virtual
|
||||
while virtualrepo:
|
||||
real = repos.get(virtualrepo)
|
||||
if real:
|
||||
req.env['REPO_NAME'] = virtual
|
||||
req.env['REPO_NAME'] = virtualrepo
|
||||
try:
|
||||
repo = hg.repository(self.ui, real)
|
||||
return hgweb(repo).run_wsgi(req)
|
||||
@ -166,16 +167,16 @@ class hgwebdir(object):
|
||||
except error.RepoError, inst:
|
||||
raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
|
||||
|
||||
# browse subdirectories
|
||||
subdir = virtual + '/'
|
||||
if [r for r in repos if r.startswith(subdir)]:
|
||||
req.respond(HTTP_OK, ctype)
|
||||
return self.makeindex(req, tmpl, subdir)
|
||||
|
||||
up = virtual.rfind('/')
|
||||
up = virtualrepo.rfind('/')
|
||||
if up < 0:
|
||||
break
|
||||
virtual = virtual[:up]
|
||||
virtualrepo = virtualrepo[:up]
|
||||
|
||||
# browse subdirectories
|
||||
subdir = virtual + '/'
|
||||
if [r for r in repos if r.startswith(subdir)]:
|
||||
req.respond(HTTP_OK, ctype)
|
||||
return self.makeindex(req, tmpl, subdir)
|
||||
|
||||
# prefixes not found
|
||||
req.respond(HTTP_NOT_FOUND, ctype)
|
||||
|
@ -77,7 +77,7 @@ should give a 404 - repo is not published
|
||||
404 Not Found
|
||||
|
||||
|
||||
error: repository c not found
|
||||
error: repository c/file/tip/c not found
|
||||
[1]
|
||||
|
||||
atom-log without basedir
|
||||
|
@ -56,19 +56,19 @@ should fail
|
||||
404 Not Found
|
||||
|
||||
|
||||
error: repository circle not found
|
||||
error: repository circle/al/file/tip/a not found
|
||||
[1]
|
||||
$ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/b/file/tip/a?style=raw'
|
||||
404 Not Found
|
||||
|
||||
|
||||
error: repository circle not found
|
||||
error: repository circle/b/file/tip/a not found
|
||||
[1]
|
||||
$ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/c/file/tip/a?style=raw'
|
||||
404 Not Found
|
||||
|
||||
|
||||
error: repository circle not found
|
||||
error: repository circle/c/file/tip/a not found
|
||||
[1]
|
||||
|
||||
collections errors
|
||||
|
Loading…
Reference in New Issue
Block a user