Boavizta / ict-sustainability-tools

This repository aims at providing to the global IT Sustainability community a vendor-neutral, fact-based, non-judgmental and exhaustive repository of the tools and services available to assess the environmental footprint of IT components.
2 stars 5 forks source link

CSV breaks if we enter a multiline comment that includes new line characters #58

Open demeringo opened 20 hours ago

demeringo commented 20 hours ago

Bug description

The data CSV file breaks if we submit a field that contains multiline text (a text that contains new line characters).

  1. The CSV generated by Datami widget does not seem to include quotes around the fields.
  2. and/or the newline ( '\n' ) chars are not escaped by the form.

The resulting CSV is broken into multilines and

  1. the CSV validation fails in CI
  2. even if we bypass the validation, the resulting CSV will not be loaded correctly in a next iteration by the widget.

To Reproduce

  1. Open the widget in edition at: https://boavizta.github.io/ict-sustainability-tools/
  2. Edit a multiline field using the widget (for example use enter key in the quick_description field).
  3. Submit the form.

Example of broken PR: https://github.com/Boavizta/ict-sustainability-tools/pull/57

Expected behavior

Either make Datami widget quote the values in the CSV or/and escape new line character prior to submitting the form.

JSON OUTPUT

Additional context

Maybe I miss something obvious in the way to configure the widget to prevent this behaviour....

If we cannot fix it, we may also just completly forbid multiline (or long) text. But this may be impractical to display and edit the description.

demeringo commented 20 hours ago

@JulienParis do you have insights about this ?