mirror of
https://github.com/cquest/tootbot.git
synced 2024-11-23 20:11:06 +00:00
hack to handle UTF8 encoded "Location" header
This commit is contained in:
parent
5b562ff379
commit
21ef9375f3
|
@ -23,6 +23,9 @@ def unredir(redir):
|
|||
if redir_count > 10:
|
||||
break
|
||||
location = r.headers.get('Location')
|
||||
if 'go.france24.com' in redir:
|
||||
# decoding hack in case "location" header is UTF-8 encoded (should not !)
|
||||
location = location.encode("latin1").decode("utf-8")
|
||||
if 'http' not in location:
|
||||
redir = re.sub(r'(https?://[^/]*).*$', r'\1', redir) + location
|
||||
else:
|
||||
|
|
Loading…
Reference in New Issue
Block a user