mirror of
https://github.com/cquest/tootbot.git
synced 2025-05-10 12:23:56 +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:
|
if redir_count > 10:
|
||||||
break
|
break
|
||||||
location = r.headers.get('Location')
|
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:
|
if 'http' not in location:
|
||||||
redir = re.sub(r'(https?://[^/]*).*$', r'\1', redir) + location
|
redir = re.sub(r'(https?://[^/]*).*$', r'\1', redir) + location
|
||||||
else:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user