KSP-SpaceDock / SpaceDock

Current Codebase (Python /Flask)
https://spacedock.info
Other
73 stars 33 forks source link

Send co-authors to CKAN as POST form lists #490

Closed HebaruSan closed 1 year ago

HebaruSan commented 1 year ago

Problem

See KSP-CKAN/NetKAN-Infra#293 and KSP-CKAN/NetKAN-Infra#294, the shared_authors property sent to CKAN just says username, so we can't use it to add the co-authors to pull requests.

Cause

435 was mis-guided; I thought the data sent to CKAN was in JSON format, but it's in POST form input format, which means it can only handle strings and lists of strings, not more complex data structures. That PR tried to send a list of dicts in the shared_authors property, which can't work.

Changes

On the CKAN side, request.form.get will return just the first element of the list, which ensures backwards compatibility, and request.form.getlist will return the entire list, which will allow a future update to get the data for all of the authors.

HebaruSan commented 1 year ago

The lists will all be the same length, see KSP-SpaceDock/SpaceDock#490. They're all generated from a list comprehension over the same list of authors.