Pulldata fails silently when csv file has spaces in the name

Github issue - Pulldata fails silently when csv file has spaces in the name · Issue #4924 · kobotoolbox/kpi · GitHub

Description

  • When attaching a CSV file in Media, there is no block on the csv having spaces in the name
  • When adding a ‘pulldata’ calculation, there is no error message or warning when the pulldata references a csv file with spaces in the name
  • When the form is then opened in Enketo, the form fails to fetch any data using the pulldata calculation. When inspecting in the browser, an error is raised from instance(‘form name with spaces’)/root/data…, but this is not shown to the user

Steps to Reproduce

  1. Create generic questionnaire/form
  2. Attach CSV file in media, where the file name contains spaces
  3. Add a calculate question to the questionnaire, using the pulldata formula, referencing the CSV file with spaces
  4. Add another question to show if the calculate question is working (e.g. a note question where the label references the output of the calculate question)
  5. Deploy
  6. Open in Enketo and fill out

Expected behavior

Either

  • Form is able to pull from CSV file, and displays pulled value
  • Kobo raises a warning when CSV file with spaces in name is uploaded
  • Kobo raises a warning when questionnaire is deployed that tries to use pulldata referring to a file with spaces in the name
  • Enketo raises an error when trying to complete the form

Actual behavior

  • CSV upload is allowed
  • No warnings raised on deployment
  • No error displayed in Enketo (without browser inspection)
  • Pulldata calculate field does not work

Additional details

I have noted this issues for spaces in the file name. It may be true for other disallowed characters as well.

Thank you, @amschel, for making a GitHub post and also sharing the same in the community. The community would also benefit if you could share a sample dummy XLSForm along with the CSV file for testing and confirming.