Project

Profile

Help

Issue #9496

closed

calling /pulp/api/v3/uploads/?ordering=completed yields a 500 internal server error

Added by thm over 2 years ago. Updated over 2 years ago.

Status:
CLOSED - CURRENTRELEASE
Priority:
Normal
Assignee:
Category:
-
Sprint/Milestone:
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 110
Quarter:

Description

Backtrace:

api_1      | pulp [fbc67c5bcf5e4d0084bcb6a4ea9b6a35]: django.request:ERROR: Internal Server Error: /pulp/api/v3/uploads/
api_1      | Traceback (most recent call last):
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/django/core/handlers/exception.py", line 47, in inner
api_1      |     response = get_response(request)
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/django/core/handlers/base.py", line 181, in _get_response
api_1      |     response = wrapped_callback(request, *callback_args, **callback_kwargs)
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/django/views/decorators/csrf.py", line 54, in wrapped_view
api_1      |     return view_func(*args, **kwargs)
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/rest_framework/viewsets.py", line 125, in view
api_1      |     return self.dispatch(request, *args, **kwargs)
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/rest_framework/views.py", line 509, in dispatch
api_1      |     response = self.handle_exception(exc)
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/rest_framework/views.py", line 469, in handle_exception
api_1      |     self.raise_uncaught_exception(exc)
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/rest_framework/views.py", line 480, in raise_uncaught_exception
api_1      |     raise exc
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/rest_framework/views.py", line 506, in dispatch
api_1      |     response = handler(request, *args, **kwargs)
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/rest_framework/mixins.py", line 38, in list
api_1      |     queryset = self.filter_queryset(self.get_queryset())
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/rest_framework/generics.py", line 150, in filter_queryset
api_1      |     queryset = backend().filter_queryset(self.request, queryset, self)
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/rest_framework/filters.py", line 283, in filter_queryset
api_1      |     return queryset.order_by(*ordering)
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/django/db/models/query.py", line 1149, in order_by
api_1      |     obj.query.add_ordering(*field_names)
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1993, in add_ordering
api_1      |     self.names_to_path(item.split(LOOKUP_SEP), self.model._meta)
api_1      |   File "/opt/pulp/lib/python3.9/site-packages/django/db/models/sql/query.py", line 1539, in names_to_path
api_1      |     raise FieldError("Cannot resolve keyword '%s' into field. "
api_1      | django.core.exceptions.FieldError: Cannot resolve keyword 'completed' into field. Choices are: chunks, pulp_created, pulp_id, pulp_labels, pulp_last_updated, size, upload

This is with pulpcore 3.16.0, pulp-rpm 3.15.0.

There are more examples like this, e.g. /pulp/api/v3/content/rpm/packages/?ordering=md5.

The ordering parameters are not invented, but chosen by clicking on the "Filters" button in the HTML view in the browser.

So, imho, there are two issues here:

  • It shouldn't generate a 500 for unknown/invalid values of the ordering parameter.
  • The "Filters" dialogue should only present valid parameters.

Also available in: Atom PDF