Fix Consumer IDs patterns

The Problem

The error occurred because: - Consumer IDs like
`'{Some(api-manager-ii)}_bd817d3c-b72d-495d-81f3-eabbf6a5bb68'` contain
characters not allowed by the original URL pattern - The original
pattern `[0-9a-z\-]+` only allowed lowercase letters, numbers, and
hyphens - The actual consumer ID contained curly braces `{}`,
parentheses `()`, underscores `_`, and uppercase letters

I updated all consumer URL patterns from: ```python [0-9a-z\-]+ ``` to:
```python [0-9a-zA-Z\-_(){}%]+ ```

This new pattern allows: - Numbers: `0-9` - Lowercase letters: `a-z` -
Uppercase letters: `A-Z` - Hyphens: `-` - Underscores: `_` -
Parentheses: `()` - Curly braces: `{}` - Percent signs: `%` (for URL
encoding)
This commit is contained in:
Marko Milić 2025-10-29 08:57:47 +01:00
parent 65ae8eaec9
commit 0a7f5b2b35

View File

@ -11,16 +11,16 @@ urlpatterns = [
re_path(r'^$',
IndexView.as_view(),
name='consumers-index'),
re_path(r'^(?P<consumer_id>[0-9a-z\-]+)$',
re_path(r'^(?P<consumer_id>[0-9a-zA-Z\-_(){}%]+)$',
DetailView.as_view(),
name='consumers-detail'),
re_path(r'^(?P<consumer_id>[0-9a-z\-]+)/enable$',
re_path(r'^(?P<consumer_id>[0-9a-zA-Z\-_(){}%]+)/enable$',
EnableView.as_view(),
name='consumers-enable'),
re_path(r'^(?P<consumer_id>[0-9a-z\-]+)/disable$',
re_path(r'^(?P<consumer_id>[0-9a-zA-Z\-_(){}%]+)/disable$',
DisableView.as_view(),
name='consumers-disable'),
re_path(r'^(?P<consumer_id>[0-9a-z\-]+)/usage-data$',
re_path(r'^(?P<consumer_id>[0-9a-zA-Z\-_(){}%]+)/usage-data$',
UsageDataAjaxView.as_view(),
name='consumers-usage-data'),
]