commit 4598237c15331cf97fb99b53593b99e8fb182ee7 Author: Arturo Filastò arturo@filasto.net Date: Thu Apr 28 12:10:15 2016 +0200
Check to ensure response_body is either a str or unicode before sanitising it (#485) --- ooni/templates/httpt.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/ooni/templates/httpt.py b/ooni/templates/httpt.py index fd6c8ab..e608f8f 100644 --- a/ooni/templates/httpt.py +++ b/ooni/templates/httpt.py @@ -172,7 +172,8 @@ class HTTPTest(NetTestCase): else: response_body = '' # Attempt to redact the IP address of the probe from the responses - if config.privacy.includeip is False and config.probe_ip.address is not None: + if (config.privacy.includeip is False and config.probe_ip.address is not None and + (isinstance(response_body, str) or isinstance(response_body, unicode))): response_body = response_body.replace(config.probe_ip.address, "[REDACTED]") session['response'] = { 'headers': _representHeaders(response.headers),