File tree Expand file tree Collapse file tree 2 files changed +14
-1
lines changed
sentry_sdk/integrations/django
tests/integrations/django Expand file tree Collapse file tree 2 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ def get_regex(resolver_or_pattern):
3737
3838class RavenResolver (object ):
3939 _optional_group_matcher = re .compile (r"\(\?\:([^\)]+)\)" )
40- _named_group_matcher = re .compile (r"\(\?P<(\w+)>[^\)]+\)+ " )
40+ _named_group_matcher = re .compile (r"\(\?P<(\w+)>.*\) " )
4141 _non_named_group_matcher = re .compile (r"\([^\)]+\)" )
4242 # [foo|bar|baz]
4343 _either_option_matcher = re .compile (r"\[([^\]]+)\|([^\]]+)\]" )
Original file line number Diff line number Diff line change 2424 url (r"^api/(?P<version>(v1|v2))/author/$" , lambda x : "" ),
2525 url (r"^report/" , lambda x : "" ),
2626 url (r"^example/" , include (included_url_conf )),
27+ url (
28+ r"^(?P<slug>[$\\-_.+!*(),\\w//]+)/$" , lambda x : ""
29+ ), # example of complex regex from django-cms
2730)
2831
2932
@@ -53,6 +56,16 @@ def test_legacy_resolver_included_match():
5356 assert result == "/example/foo/bar/{param}"
5457
5558
59+ def test_complex_regex_from_django_cms ():
60+ """
61+ Reference: https://github.com/getsentry/sentry-python/issues/1527
62+ """
63+
64+ resolver = RavenResolver ()
65+ result = resolver .resolve ("/,/" , example_url_conf )
66+ assert result == "/{slug}/"
67+
68+
5669@pytest .mark .skipif (django .VERSION < (2 , 0 ), reason = "Requires Django > 2.0" )
5770def test_legacy_resolver_newstyle_django20_urlconf ():
5871 from django .urls import path
You can’t perform that action at this time.
0 commit comments