unioslo / mreg

GNU General Public License v3.0
7 stars 13 forks source link

Creating new labels by posting to the api/v1/labels/ endpoint returns the wrong location. #532

Open terjekv opened 2 months ago

terjekv commented 2 months ago

I'm not sure why this was ever done, but it seems very very broken:

https://github.com/unioslo/mreg/blob/eed5c154bcc47b1dea474feabad46125ebde0aec/mreg/api/v1/views_labels.py#L30 https://github.com/unioslo/mreg/blob/eed5c154bcc47b1dea474feabad46125ebde0aec/mreg/api/v1/views.py#L187

The label has a proper ID. Using the label won't work, but we could use https://github.com/unioslo/mreg/blob/eed5c154bcc47b1dea474feabad46125ebde0aec/mreg/api/v1/urls.py#L33 to look up the label by name... But this isn't the endpoint the Location header points to...

Needs fixing. Badly.