Browse Source

web/jump/views.py: fix original GET params order

Before this requesting /jump/example.i2p/foo?a=b&c=d produced redirect
as http://example.i2p/?i2paddresshelper=key/foo?a=b&c=d

Now it http://example.i2p/foo?a=b&c=d&i2paddresshelper=key
pull/1/head
Hidden Z 14 years ago
parent
commit
349cb809a2
  1. 12
      web/jump/views.py

12
web/jump/views.py

@ -22,13 +22,23 @@ def jumper(request, host):
return render_to_response('jump-unknown.html', { return render_to_response('jump-unknown.html', {
'title': settings.SITE_NAME, 'title': settings.SITE_NAME,
}) })
url = 'http://' + hostname + '/?i2paddresshelper=' + key # begin forming url
url = 'http://' + hostname
# get params from requst string, e.g. from 'example.i2p/smth/1?a=b&c=d' get 'smth/1?a=b&c=d' # get params from requst string, e.g. from 'example.i2p/smth/1?a=b&c=d' get 'smth/1?a=b&c=d'
pattern = host + r'/(.+)' pattern = host + r'/(.+)'
m = re.search(pattern, request.get_full_path()) m = re.search(pattern, request.get_full_path())
if m: if m:
params = m.group(1) params = m.group(1)
url += '/' + params url += '/' + params
# determine how we should pass i2paddresshelper
# http://zzz.i2p/oldnews.html#jump
if params.find('?') == -1:
suffix = '?'
else:
suffix = '&'
url += suffix + 'i2paddresshelper=' + key
else:
url += '/?i2paddresshelper=' + key
return render_to_response('jump.html', { return render_to_response('jump.html', {
'title': settings.SITE_NAME, 'title': settings.SITE_NAME,
'url': url, 'url': url,

Loading…
Cancel
Save