django-advanced-filters
django-advanced-filters copied to clipboard
ValueError: not enough values to unpack
Describe the bug
When invalid args are given to URL field_choices/..., especially a model which doesnt include a ., the logic raises an exception.
This occurs for example when a smoke tester hits a server with lots of invalid requests in order to find bugs, including security problems.
To Reproduce Steps to reproduce the behavior:
- Go to `field_choices/foobar/blah'
- See error
Expected behavior A 400 error should occur indicating that the client request is invalid.
Additional context
Traceback (most recent call last):
...
File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 71, in view
return self.dispatch(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/utils/decorators.py", line 45, in _wrapper
return bound_method(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
return view_func(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/braces/views/_forms.py", line 24, in dispatch
return super(CsrfExemptMixin, self).dispatch(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/braces/views/_access.py", line 407, in dispatch
request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/django/views/generic/base.py", line 97, in dispatch
return handler(request, *args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/advanced_filters/views.py", line 34, in get
app_label, model_name = model.split('.', 1)
ValueError: not enough values to unpack (expected 2, got 1)