##// END OF EJS Templates
hgweb: set variables in qsparams...
Gregory Szorc -
r36880:4e06e833 default
parent child Browse files
Show More
@@ -342,15 +342,22 b' class hgweb(object):'
342 # avoid accepting e.g. style parameter as command
342 # avoid accepting e.g. style parameter as command
343 if util.safehasattr(webcommands, cmd):
343 if util.safehasattr(webcommands, cmd):
344 wsgireq.form['cmd'] = [cmd]
344 wsgireq.form['cmd'] = [cmd]
345 req.qsparams['cmd'] = cmd
345
346
346 if cmd == 'static':
347 if cmd == 'static':
347 wsgireq.form['file'] = ['/'.join(args)]
348 wsgireq.form['file'] = ['/'.join(args)]
349 req.qsparams['file'] = '/'.join(args)
348 else:
350 else:
349 if args and args[0]:
351 if args and args[0]:
350 node = args.pop(0).replace('%2F', '/')
352 node = args.pop(0).replace('%2F', '/')
351 wsgireq.form['node'] = [node]
353 wsgireq.form['node'] = [node]
354 req.qsparams['node'] = node
352 if args:
355 if args:
353 wsgireq.form['file'] = args
356 wsgireq.form['file'] = args
357 if 'file' in req.qsparams:
358 del req.qsparams['file']
359 for a in args:
360 req.qsparams.add('file', a)
354
361
355 ua = req.headers.get('User-Agent', '')
362 ua = req.headers.get('User-Agent', '')
356 if cmd == 'rev' and 'mercurial' in ua:
363 if cmd == 'rev' and 'mercurial' in ua:
@@ -362,7 +369,9 b' class hgweb(object):'
362 ext = spec[2]
369 ext = spec[2]
363 if fn.endswith(ext):
370 if fn.endswith(ext):
364 wsgireq.form['node'] = [fn[:-len(ext)]]
371 wsgireq.form['node'] = [fn[:-len(ext)]]
372 req.qsparams['node'] = fn[:-len(next)]
365 wsgireq.form['type'] = [type_]
373 wsgireq.form['type'] = [type_]
374 req.qsparams['type'] = type_
366 else:
375 else:
367 cmd = wsgireq.form.get('cmd', [''])[0]
376 cmd = wsgireq.form.get('cmd', [''])[0]
368
377
@@ -379,6 +388,7 b' class hgweb(object):'
379
388
380 if cmd == '':
389 if cmd == '':
381 wsgireq.form['cmd'] = [tmpl.cache['default']]
390 wsgireq.form['cmd'] = [tmpl.cache['default']]
391 req.qsparams['cmd'] = tmpl.cache['default']
382 cmd = wsgireq.form['cmd'][0]
392 cmd = wsgireq.form['cmd'][0]
383
393
384 # Don't enable caching if using a CSP nonce because then it wouldn't
394 # Don't enable caching if using a CSP nonce because then it wouldn't
General Comments 0
You need to be logged in to leave comments. Login now