bughelp wanted
Description
Expected behavior
Exception is thrown:
web_1 | Mongoose model 'error' event fired on 'Post' with error:
web_1 | List.getData: fields must be undefined, a string, or an array. Error: List.getData: fields must be undefined, a string, or an array.
web_1 | at keystone.List.getData (/opt/app/node_modules/keystone/lib/list/getData.js:23:10)
....
Steps to reproduce the actual/current behavior
- Go to a list in admin ui
- chose export
- select a few fields
Suggested fix
The admin UI sends the query param select with the fields to export as a comma separated string, while /lib/list/getData.js expects fields to be an array. This leaves to options to fix the issue:
- Patch admin UI, modify
/admin/client/utils/List.js#getDownloadURLstringify the query so that it gets parsed by the express servers querystring parser correctly. - Split
fieldsinto an array if its a string in/lib/list/getData.js
What's your preference? Are you using comma separated query strings elsewhere?