Maintenance: Planio will be observing a scheduled maintenance window this Tuesday, November 5, 2024 from 03:00 UTC until 06:30 UTC to perform urgent network maintenance in our primary data center. Your Planio account will be unavailable during this maintenance window.
Actions
Issue #7468
closedInternal error when adding (wrong) content advisory
Start date:
Due date:
Estimated time:
Severity:
2. Medium
Version:
Platform Release:
OS:
Triaged:
Yes
Groomed:
No
Sprint Candidate:
No
Tags:
Sprint:
Sprint 82
Quarter:
Description
Accidentally sent an RPM as file
to ContentAdvisoriesApi().create()
, yielding an Server Error (500). It probably should throw a ValidationError
instead.
Here's the stacktrace
api_1 | pulp: django.request:ERROR: Internal Server Error: /pulp/api/v3/content/rpm/advisories/
api_1 | Traceback (most recent call last):
api_1 | File "/opt/pulp/lib/python3.8/site-packages/django/core/handlers/exception.py", line 34, in inner
api_1 | response = get_response(request)
api_1 | File "/opt/pulp/lib/python3.8/site-packages/django/core/handlers/base.py", line 115, in _get_response
api_1 | response = self.process_exception_by_middleware(e, request)
api_1 | File "/opt/pulp/lib/python3.8/site-packages/django/core/handlers/base.py", line 113, in _get_response
api_1 | response = wrapped_callback(request, *callback_args, **callback_kwargs)
api_1 | File "/opt/pulp/lib/python3.8/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.8/site-packages/rest_framework/viewsets.py", line 114, in view
api_1 | return self.dispatch(request, *args, **kwargs)
api_1 | File "/opt/pulp/lib/python3.8/site-packages/rest_framework/views.py", line 505, in dispatch
api_1 | response = self.handle_exception(exc)
api_1 | File "/opt/pulp/lib/python3.8/site-packages/rest_framework/views.py", line 465, in handle_exception
api_1 | self.raise_uncaught_exception(exc)
api_1 | File "/opt/pulp/lib/python3.8/site-packages/rest_framework/views.py", line 476, in raise_uncaught_exception
api_1 | raise exc
api_1 | File "/opt/pulp/lib/python3.8/site-packages/rest_framework/views.py", line 502, in dispatch
api_1 | response = handler(request, *args, **kwargs)
api_1 | File "/opt/pulp/lib/python3.8/site-packages/pulpcore/plugin/viewsets/content.py", line 47, in create
api_1 | serializer.is_valid(raise_exception=True)
api_1 | File "/opt/pulp/lib/python3.8/site-packages/rest_framework/serializers.py", line 235, in is_valid
api_1 | self._validated_data = self.run_validation(self.initial_data)
api_1 | File "/opt/pulp/lib/python3.8/site-packages/rest_framework/serializers.py", line 433, in run_validation
api_1 | value = self.validate(value)
api_1 | File "/opt/pulp/lib/python3.8/site-packages/pulp_rpm/app/serializers/advisory.py", line 204, in validate
api_1 | update_record_data.update(json.loads(data["file"].read()))
api_1 | File "/usr/lib64/python3.8/json/__init__.py", line 343, in loads
api_1 | s = s.decode(detect_encoding(s), 'surrogatepass')
api_1 | UnicodeDecodeError: 'utf-8' codec can't decode byte 0xed in position 0: invalid continuation byte
Updated by fao89 about 4 years ago
We need to improve UpdateRecordSerializer validation
api_1 | File "/opt/pulp/lib/python3.8/site-packages/pulp_rpm/app/serializers/advisory.py", line 204, in validate
api_1 | update_record_data.update(json.loads(data["file"].read()))
it is breaking because it is trying to convert an RPM into JSON
Updated by ipanova@redhat.com about 4 years ago
- Status changed from NEW to ASSIGNED
- Assignee set to ipanova@redhat.com
Updated by pulpbot about 4 years ago
- Status changed from ASSIGNED to POST
Added by ipanova@redhat.com about 4 years ago
Updated by ipanova@redhat.com about 4 years ago
- Status changed from POST to MODIFIED
Applied in changeset 6b78e365962fdb00c529f455b3882b191bc0615b.
Updated by pulpbot almost 4 years ago
- Status changed from MODIFIED to CLOSED - CURRENTRELEASE
Actions
Raise ValidationError when other type than json is provided during Advisory upload.
[nocoverage]
closes #7468 https://pulp.plan.io/issues/7468