##// END OF EJS Templates
hgwebdir: fix incorrect index generation for invalid paths (issue2023)...
Wagner Bruna -
r13066:86888ae9 stable
parent child Browse files
Show More
@@ -153,10 +153,11 b' class hgwebdir(object):'
153 # nested indexes and hgwebs
153 # nested indexes and hgwebs
154
154
155 repos = dict(self.repos)
155 repos = dict(self.repos)
156 while virtual:
156 virtualrepo = virtual
157 real = repos.get(virtual)
157 while virtualrepo:
158 real = repos.get(virtualrepo)
158 if real:
159 if real:
159 req.env['REPO_NAME'] = virtual
160 req.env['REPO_NAME'] = virtualrepo
160 try:
161 try:
161 repo = hg.repository(self.ui, real)
162 repo = hg.repository(self.ui, real)
162 return hgweb(repo).run_wsgi(req)
163 return hgweb(repo).run_wsgi(req)
@@ -166,17 +167,17 b' class hgwebdir(object):'
166 except error.RepoError, inst:
167 except error.RepoError, inst:
167 raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
168 raise ErrorResponse(HTTP_SERVER_ERROR, str(inst))
168
169
170 up = virtualrepo.rfind('/')
171 if up < 0:
172 break
173 virtualrepo = virtualrepo[:up]
174
169 # browse subdirectories
175 # browse subdirectories
170 subdir = virtual + '/'
176 subdir = virtual + '/'
171 if [r for r in repos if r.startswith(subdir)]:
177 if [r for r in repos if r.startswith(subdir)]:
172 req.respond(HTTP_OK, ctype)
178 req.respond(HTTP_OK, ctype)
173 return self.makeindex(req, tmpl, subdir)
179 return self.makeindex(req, tmpl, subdir)
174
180
175 up = virtual.rfind('/')
176 if up < 0:
177 break
178 virtual = virtual[:up]
179
180 # prefixes not found
181 # prefixes not found
181 req.respond(HTTP_NOT_FOUND, ctype)
182 req.respond(HTTP_NOT_FOUND, ctype)
182 return tmpl("notfound", repo=virtual)
183 return tmpl("notfound", repo=virtual)
@@ -77,7 +77,7 b' should give a 404 - repo is not publishe'
77 404 Not Found
77 404 Not Found
78
78
79
79
80 error: repository c not found
80 error: repository c/file/tip/c not found
81 [1]
81 [1]
82
82
83 atom-log without basedir
83 atom-log without basedir
@@ -56,19 +56,19 b' should fail'
56 404 Not Found
56 404 Not Found
57
57
58
58
59 error: repository circle not found
59 error: repository circle/al/file/tip/a not found
60 [1]
60 [1]
61 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/b/file/tip/a?style=raw'
61 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/b/file/tip/a?style=raw'
62 404 Not Found
62 404 Not Found
63
63
64
64
65 error: repository circle not found
65 error: repository circle/b/file/tip/a not found
66 [1]
66 [1]
67 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/c/file/tip/a?style=raw'
67 $ "$TESTDIR/get-with-headers.py" localhost:$HGPORT '/circle/c/file/tip/a?style=raw'
68 404 Not Found
68 404 Not Found
69
69
70
70
71 error: repository circle not found
71 error: repository circle/c/file/tip/a not found
72 [1]
72 [1]
73
73
74 collections errors
74 collections errors
General Comments 0
You need to be logged in to leave comments. Login now