mercurial/hgweb/hgweb_mod.py
changeset 36870 4e06e8336634
parent 36869 1a1972b1a1ff
child 36871 3d60a22e27f5
equal deleted inserted replaced
36869:1a1972b1a1ff 36870:4e06e8336634
   340                 cmd = cmd[style + 1:]
   340                 cmd = cmd[style + 1:]
   341 
   341 
   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:
   357                 req.qsparams['style'] = 'raw'
   364                 req.qsparams['style'] = 'raw'
   358 
   365 
   360                 fn = wsgireq.form['node'][0]
   367                 fn = wsgireq.form['node'][0]
   361                 for type_, spec in rctx.archivespecs.iteritems():
   368                 for type_, spec in rctx.archivespecs.iteritems():
   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 
   369         # process the web interface request
   378         # process the web interface request
   370 
   379 
   377             if cmd != 'static':
   386             if cmd != 'static':
   378                 self.check_perm(rctx, wsgireq, None)
   387                 self.check_perm(rctx, wsgireq, None)
   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
   385             # be a nonce.
   395             # be a nonce.
   386             if rctx.configbool('web', 'cache') and not rctx.nonce:
   396             if rctx.configbool('web', 'cache') and not rctx.nonce: