enketo-core
enketo-core copied to clipboard
Single and double quotes in pulldata CSV function will cause XPath evaluator error
Describe the bug single and double quotes in pulldata CSV function will cause XPath evaluator error
To Reproduce Steps to reproduce the behavior. If applicable please include the smallest possible XLSForm or XForm (as zip or link).
-
create an text question with
concat('The street is ',pulldata('Intersections', 'Street1', 'IntersectionID', ${intersection_id}))
calculation. pulldata-test.xlsx -
upload the CSV file.
IntersectionID | Street1 |
---|---|
1000 | Spencer" St |
2000 | King' St |
3000 | William St |
- Run the survey, select IntersectionID 1000 or 2000
- See error
"Could not evaluate: concat('The street is ', "Spencer" St"), message: The expression is not a legal expression."
Expected behavior
- Pulldata CSV function can use in other function
Screenshots
This maybe because of the _replacePullDataFn in form-model. The pullDataResult
will wrapper by double-quotes. when the pulldata result have single or double quotes will cause this error.
https://github.com/enketo/enketo-core/blob/b83271e8cc88fb79ddeb4f79fb1194d2aac9f421/src/js/form-model.js#L1142-L1156