File tree 2 files changed +14
-1
lines changed
sentry_sdk/integrations/django
tests/integrations/django
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):
37
37
38
38
class RavenResolver (object ):
39
39
_optional_group_matcher = re .compile (r"\(\?\:([^\)]+)\)" )
40
- _named_group_matcher = re .compile (r"\(\?P<(\w+)>[^\)]+\)+ " )
40
+ _named_group_matcher = re .compile (r"\(\?P<(\w+)>.*\) " )
41
41
_non_named_group_matcher = re .compile (r"\([^\)]+\)" )
42
42
# [foo|bar|baz]
43
43
_either_option_matcher = re .compile (r"\[([^\]]+)\|([^\]]+)\]" )
Original file line number Diff line number Diff line change 24
24
url (r"^api/(?P<version>(v1|v2))/author/$" , lambda x : "" ),
25
25
url (r"^report/" , lambda x : "" ),
26
26
url (r"^example/" , include (included_url_conf )),
27
+ url (
28
+ r"^(?P<slug>[$\\-_.+!*(),\\w//]+)/$" , lambda x : ""
29
+ ), # example of complex regex from django-cms
27
30
)
28
31
29
32
@@ -53,6 +56,16 @@ def test_legacy_resolver_included_match():
53
56
assert result == "/example/foo/bar/{param}"
54
57
55
58
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
+
56
69
@pytest .mark .skipif (django .VERSION < (2 , 0 ), reason = "Requires Django > 2.0" )
57
70
def test_legacy_resolver_newstyle_django20_urlconf ():
58
71
from django .urls import path
You can’t perform that action at this time.
0 commit comments