Bug in pdf export via API?
Closed this issue · 2 comments
hmpf commented
Stacktrace for /api/v2/plans/INT/export.pdf
:
a bytes-like object is required, not 'dict'
The stacktrace contains no information about where the bug was triggered.
However, a superuser can get the actual pdf from the same url just fine, with no visible 500 server error anywhere.
hmpf commented
This only happens on unauthorized access. It turns out that when using the action
-decorator with permission_classes
set, the renderer must handle such errors. It cannot be left to the decorated function. Neither is it possible to change the content type, so it is an open question how to handle this for the dot-renderers.
hmpf commented
Now, a 401-error is raised instead, leading to a single-page pdf with the single line "401 Unauthorized" in it :)