hmpf / easydmp

MIT License
7 stars 2 forks source link

Bug in pdf export via API? #223

Closed hmpf closed 2 years ago

hmpf commented 3 years ago

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 3 years ago

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 2 years ago

Now, a 401-error is raised instead, leading to a single-page pdf with the single line "401 Unauthorized" in it :)