##// 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 logourl = self.config('web', 'logourl')
148 logourl = self.config('web', 'logourl')
149 logoimg = self.config('web', 'logoimg')
149 logoimg = self.config('web', 'logoimg')
150 staticurl = (self.config('web', 'staticurl')
150 staticurl = (self.config('web', 'staticurl')
151 or pycompat.sysbytes(wsgireq.url) + 'static/')
151 or req.apppath + '/static/')
152 if not staticurl.endswith('/'):
152 if not staticurl.endswith('/'):
153 staticurl += '/'
153 staticurl += '/'
154
154
@@ -170,7 +170,7 b' class requestcontext(object):'
170 if not self.reponame:
170 if not self.reponame:
171 self.reponame = (self.config('web', 'name', '')
171 self.reponame = (self.config('web', 'name', '')
172 or wsgireq.env.get('REPO_NAME')
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 def websubfilter(text):
175 def websubfilter(text):
176 return templatefilters.websub(text, self.websubtable)
176 return templatefilters.websub(text, self.websubtable)
@@ -178,7 +178,7 b' class requestcontext(object):'
178 # create the templater
178 # create the templater
179 # TODO: export all keywords: defaults = templatekw.keywords.copy()
179 # TODO: export all keywords: defaults = templatekw.keywords.copy()
180 defaults = {
180 defaults = {
181 'url': pycompat.sysbytes(wsgireq.url),
181 'url': req.apppath + '/',
182 'logourl': logourl,
182 'logourl': logourl,
183 'logoimg': logoimg,
183 'logoimg': logoimg,
184 'staticurl': staticurl,
184 'staticurl': staticurl,
@@ -187,7 +187,7 b' class requestcontext(object):'
187 'encoding': encoding.encoding,
187 'encoding': encoding.encoding,
188 'motd': motd,
188 'motd': motd,
189 'sessionvars': sessionvars,
189 'sessionvars': sessionvars,
190 'pathdef': makebreadcrumb(pycompat.sysbytes(wsgireq.url)),
190 'pathdef': makebreadcrumb(req.apppath),
191 'style': style,
191 'style': style,
192 'nonce': self.nonce,
192 'nonce': self.nonce,
193 }
193 }
@@ -318,8 +318,6 b' class hgweb(object):'
318 if h[0] != 'Content-Security-Policy']
318 if h[0] != 'Content-Security-Policy']
319 wsgireq.headers.append(('Content-Security-Policy', rctx.csp))
319 wsgireq.headers.append(('Content-Security-Policy', rctx.csp))
320
320
321 wsgireq.url = pycompat.sysstr(req.apppath)
322
323 if r'PATH_INFO' in wsgireq.env:
321 if r'PATH_INFO' in wsgireq.env:
324 parts = wsgireq.env[r'PATH_INFO'].strip(r'/').split(r'/')
322 parts = wsgireq.env[r'PATH_INFO'].strip(r'/').split(r'/')
325 repo_parts = wsgireq.env.get(r'REPO_NAME', r'').split(r'/')
323 repo_parts = wsgireq.env.get(r'REPO_NAME', r'').split(r'/')
@@ -146,14 +146,13 b' def parserequestfromenv(env):'
146 # root. We also exclude its path components from PATH_INFO when resolving
146 # root. We also exclude its path components from PATH_INFO when resolving
147 # the dispatch path.
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 apppath = env['SCRIPT_NAME']
149 apppath = env['SCRIPT_NAME']
152 if not apppath.endswith('/'):
153 apppath += '/'
154
150
155 if env.get('REPO_NAME'):
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 if 'PATH_INFO' in env:
157 if 'PATH_INFO' in env:
159 dispatchparts = env['PATH_INFO'].strip('/').split('/')
158 dispatchparts = env['PATH_INFO'].strip('/').split('/')
General Comments 0
You need to be logged in to leave comments. Login now