Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Searching/sorting on fields with leading spaces fail (Grid or API) #1970

Closed
aliceh75 opened this issue Oct 10, 2014 · 3 comments
Closed

Searching/sorting on fields with leading spaces fail (Grid or API) #1970

aliceh75 opened this issue Oct 10, 2014 · 3 comments
Assignees
Milestone

Comments

@aliceh75
Copy link
Contributor

How to reproduce

Upload the following CSV to the Datapusher:

my field, another field, third field
value 1, value 2, value 3

That this will create fields named " another field" and " third field".

In the grid view, it is not possible to sort or search on either of those fields. I assume using the API it would also not be possible to sort on those fields (though search should work).

The problem

Parts of the code does not trim field names (for instance the datapusher, and the datastore_create API); however other parts of the code does trim field names (for instance the code that splits a sort string: " another field, third field" becomes ['another field', 'third field'])

A solution

Given that there is no practical use for having field names that contain leading or ending spaces, I suggest the datastore API should trim field names.

@aliceh75
Copy link
Contributor Author

See PR #1971 for CKAN, and PR ckan/datapusher#47 for the datapusher.

@amercader amercader added this to the CKAN 2.3 milestone Oct 22, 2014
@aliceh75
Copy link
Contributor Author

aliceh75 commented Nov 3, 2014

Now that #1971 has been merged, it will not be possible to insert new data with fields that start/end with whitespaces. So this issue now only affects already uploaded data.

@wardi
Copy link
Contributor

wardi commented Nov 3, 2014

I think it's reasonable to suggest users fix and re-upload their data in this case.

@wardi wardi closed this as completed Nov 3, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants