mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-28 00:07:57 -05:00
added handling of unicode destinations on redirects. Also fixed a 500 when submit tries to redirect to a /comments apge
This commit is contained in:
@@ -52,7 +52,7 @@ from r2.lib.organic import update_pos
|
||||
|
||||
def link_listing_by_url(url, count = None):
|
||||
try:
|
||||
links = tup(Link._by_url(url, sr = c.site))
|
||||
links = list(tup(Link._by_url(url, sr = c.site)))
|
||||
links.sort(key = lambda x: -x._score)
|
||||
if count is not None:
|
||||
links = links[:count]
|
||||
|
||||
@@ -25,7 +25,7 @@ from pylons.controllers import WSGIController, Controller
|
||||
from pylons.i18n import N_, _, ungettext, get_lang
|
||||
import r2.lib.helpers as h
|
||||
from r2.lib.utils import to_js
|
||||
from r2.lib.filters import spaceCompress
|
||||
from r2.lib.filters import spaceCompress, _force_unicode
|
||||
from utils import storify, string2js, read_http_date
|
||||
|
||||
import re, md5
|
||||
@@ -90,7 +90,7 @@ class BaseController(WSGIController):
|
||||
|
||||
@staticmethod
|
||||
def redirect(dest, code = 302):
|
||||
c.response.headers['Location'] = dest
|
||||
c.response.headers['Location'] = _force_unicode(dest).encode('utf8')
|
||||
c.response.status_code = code
|
||||
return c.response
|
||||
|
||||
|
||||
Reference in New Issue
Block a user