diff --git a/rollbar/lib/transforms/scruburl.py b/rollbar/lib/transforms/scruburl.py index d14a505a..593fa9f4 100644 --- a/rollbar/lib/transforms/scruburl.py +++ b/rollbar/lib/transforms/scruburl.py @@ -42,7 +42,7 @@ def redact(self, url_string): try: url_parts = urlsplit(url_string) - qs_params = parse_qs(url_parts.query) + qs_params = parse_qs(url_parts.query, keep_blank_values=True) except: # This isn't a URL, return url_string which is a no-op # for this transform diff --git a/rollbar/test/test_scruburl_transform.py b/rollbar/test/test_scruburl_transform.py index 94cf4107..d5ab2e4d 100644 --- a/rollbar/test/test_scruburl_transform.py +++ b/rollbar/test/test_scruburl_transform.py @@ -49,7 +49,7 @@ def _compare_urls(self, url1, url2): url2 = '//%s' % url2 parsed_urls = map(urlparse, (url1, url2)) - qs_params = map(lambda x: parse_qs(x.query), parsed_urls) + qs_params = map(lambda x: parse_qs(x.query, keep_blank_values=True), parsed_urls) num_params = map(len, qs_params) param_names = map(lambda x: set(x.keys()), qs_params) @@ -116,6 +116,11 @@ def test_scrub_missing_scheme_and_double_slash(self): expected = obj.replace('secr3t', '------').replace('secret', '------') self._assertScrubbed(['password'], obj, expected) + def test_keep_blank_url_params(self): + obj = 'http://foo.com/asdf?foo=bar&baz=' + expected = obj + self._assertScrubbed(['password'], obj, expected, skip_id_check=True) + def test_scrub_dict_val_isnt_string(self): # This link will *not* be scrubbed because the value isn't a string or bytes