File tree Expand file tree Collapse file tree 2 files changed +10
-1
lines changed
sentry_sdk/integrations/django
tests/integrations/django Expand file tree Collapse file tree 2 files changed +10
-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 19
19
20
20
example_url_conf = (
21
21
url (r"^api/(?P<project_id>[\w_-]+)/store/$" , lambda x : "" ),
22
+ url (r"^api/(?P<version>(v1|v2))/author/$" , lambda x : "" ),
22
23
url (r"^report/" , lambda x : "" ),
23
24
url (r"^example/" , include (included_url_conf )),
24
25
)
@@ -36,6 +37,14 @@ def test_legacy_resolver_complex_match():
36
37
assert result == "/api/{project_id}/store/"
37
38
38
39
40
+ def test_legacy_resolver_complex_either_match ():
41
+ resolver = RavenResolver ()
42
+ result = resolver .resolve ("/api/v1/author/" , example_url_conf )
43
+ assert result == "/api/{version}/author/"
44
+ result = resolver .resolve ("/api/v2/author/" , example_url_conf )
45
+ assert result == "/api/{version}/author/"
46
+
47
+
39
48
def test_legacy_resolver_included_match ():
40
49
resolver = RavenResolver ()
41
50
result = resolver .resolve ("/example/foo/bar/baz" , example_url_conf )
You can’t perform that action at this time.
0 commit comments