ephes / django-cast

Django and Wagtail based blogging / podcasting app
Other
56 stars 6 forks source link

Update Theme Endpoint Breaks on Integer Payload #155

Closed ephes closed 4 months ago

ephes commented 4 months ago

How to reproduce:

import requests
url = "https://wersdoerfer.de/blogs/api/update_theme/"
r = requests.post(url, json=1)
print(r.status_code)
500

From sentry:

AttributeError: 'int' object has no attribute 'get'
(4 additional frame(s) were not displayed)
...
  File "rest_framework/views.py", line 509, in dispatch
    response = self.handle_exception(exc)
  File "rest_framework/views.py", line 469, in handle_exception
    self.raise_uncaught_exception(exc)
  File "rest_framework/views.py", line 480, in raise_uncaught_exception
    raise exc
  File "rest_framework/views.py", line 506, in dispatch
    response = handler(request, *args, **kwargs)
  File "cast/api/views.py", line 267, in post
    new_theme_slug = request.data.get("theme_slug", None)