diff options
author | Armin Ronacher <armin.ronacher@active-4.com> | 2016-11-17 18:11:47 +0100 |
---|---|---|
committer | Armin Ronacher <armin.ronacher@active-4.com> | 2016-11-17 18:11:47 +0100 |
commit | a73f022a971d8dd8eee0a9d911d7a1d6f1f154a7 (patch) | |
tree | 5623fb6961bb25b5d1ca973ba03516714a77799d | |
parent | 0d9bcff9eda54e7bd5bba67329f8b86d43c65ebb (diff) | |
download | raven-a73f022a971d8dd8eee0a9d911d7a1d6f1f154a7.tar.gz |
Automatically strip whitespace in DSNs. This fixes #907
-rw-r--r-- | CHANGES | 5 | ||||
-rw-r--r-- | raven/conf/remote.py | 2 | ||||
-rw-r--r-- | tests/conf/tests.py | 10 |
3 files changed, 16 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Version 5.33.0 +-------------- + +* Strip whitespace from DNSs automatically. + Version 5.32.0 -------------- diff --git a/raven/conf/remote.py b/raven/conf/remote.py index 10149c4..d7f0605 100644 --- a/raven/conf/remote.py +++ b/raven/conf/remote.py @@ -84,7 +84,7 @@ class RemoteConfig(object): if PY2: value = to_string(value) - url = urlparse(value) + url = urlparse(value.strip()) if url.scheme not in ('http', 'https'): warnings.warn('Transport selection via DSN is deprecated. You should explicitly pass the transport class to Client() instead.') diff --git a/tests/conf/tests.py b/tests/conf/tests.py index 9caa242..e02a1fb 100644 --- a/tests/conf/tests.py +++ b/tests/conf/tests.py @@ -10,6 +10,16 @@ from raven.utils.testutils import TestCase class RemoteConfigTest(TestCase): + def test_path_strip(self): + dsn = 'https://foo:bar@sentry.local/app/1\n' + res = RemoteConfig.from_string(dsn) + assert res.project == '1' + assert res.base_url == 'https://sentry.local/app' + assert res.store_endpoint == 'https://sentry.local/app/api/1/store/' + assert res.public_key == 'foo' + assert res.secret_key == 'bar' + assert res.options == {} + def test_path(self): dsn = 'https://foo:bar@sentry.local/app/1' res = RemoteConfig.from_string(dsn) |