##// END OF EJS Templates
hgweb: use the parsed application path directly...
Gregory Szorc -
r36826:0031e972 default
parent child Browse files
Show More
@@ -148,7 +148,7 b' class requestcontext(object):'
148 148 logourl = self.config('web', 'logourl')
149 149 logoimg = self.config('web', 'logoimg')
150 150 staticurl = (self.config('web', 'staticurl')
151 or pycompat.sysbytes(wsgireq.url) + 'static/')
151 or req.apppath + '/static/')
152 152 if not staticurl.endswith('/'):
153 153 staticurl += '/'
154 154
@@ -170,7 +170,7 b' class requestcontext(object):'
170 170 if not self.reponame:
171 171 self.reponame = (self.config('web', 'name', '')
172 172 or wsgireq.env.get('REPO_NAME')
173 or wsgireq.url.strip(r'/') or self.repo.root)
173 or req.apppath or self.repo.root)
174 174
175 175 def websubfilter(text):
176 176 return templatefilters.websub(text, self.websubtable)
@@ -178,7 +178,7 b' class requestcontext(object):'
178 178 # create the templater
179 179 # TODO: export all keywords: defaults = templatekw.keywords.copy()
180 180 defaults = {
181 'url': pycompat.sysbytes(wsgireq.url),
181 'url': req.apppath + '/',
182 182 'logourl': logourl,
183 183 'logoimg': logoimg,
184 184 'staticurl': staticurl,
@@ -187,7 +187,7 b' class requestcontext(object):'
187 187 'encoding': encoding.encoding,
188 188 'motd': motd,
189 189 'sessionvars': sessionvars,
190 'pathdef': makebreadcrumb(pycompat.sysbytes(wsgireq.url)),
190 'pathdef': makebreadcrumb(req.apppath),
191 191 'style': style,
192 192 'nonce': self.nonce,
193 193 }
@@ -318,8 +318,6 b' class hgweb(object):'
318 318 if h[0] != 'Content-Security-Policy']
319 319 wsgireq.headers.append(('Content-Security-Policy', rctx.csp))
320 320
321 wsgireq.url = pycompat.sysstr(req.apppath)
322
323 321 if r'PATH_INFO' in wsgireq.env:
324 322 parts = wsgireq.env[r'PATH_INFO'].strip(r'/').split(r'/')
325 323 repo_parts = wsgireq.env.get(r'REPO_NAME', r'').split(r'/')
@@ -146,14 +146,13 b' def parserequestfromenv(env):'
146 146 # root. We also exclude its path components from PATH_INFO when resolving
147 147 # the dispatch path.
148 148
149 # TODO the use of trailing slashes in apppath is arguably wrong. We need it
150 # to appease low-level parts of hgweb_mod for now.
151 149 apppath = env['SCRIPT_NAME']
152 if not apppath.endswith('/'):
153 apppath += '/'
154 150
155 151 if env.get('REPO_NAME'):
156 apppath += env.get('REPO_NAME') + '/'
152 if not apppath.endswith('/'):
153 apppath += '/'
154
155 apppath += env.get('REPO_NAME')
157 156
158 157 if 'PATH_INFO' in env:
159 158 dispatchparts = env['PATH_INFO'].strip('/').split('/')
General Comments 0
You need to be logged in to leave comments. Login now