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

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

Open
demeringo opened this issue Nov 18, 2024 · 2 comments
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@demeringo
Copy link
Contributor

demeringo commented Nov 18, 2024

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: #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 demeringo added bug Something isn't working help wanted Extra attention is needed labels Nov 18, 2024
@demeringo
Copy link
Contributor Author

@JulienParis do you have insights about this ?

@JulienParis
Copy link
Contributor

JulienParis commented Nov 19, 2024

Hi @demeringo. Yes there is a way to have text breaks inside a csv cell with Datami, for a longtext subtype.

  1. You'd need to replace every break from your csv by a separator of your own choice, such as //
  2. Then you'd need to update your custom props file and precise there in which columns Datami is supposed to use this separator
  3. You can do the same if you have bullets. See example below =>

So in your custom props json file :

// custom-props.json
...
{
  "name": "<COLUMN NAME>",
  "subtype": "longtext",
  "maxLength": 150,
  "longtextOptions": {
    "breakSeparator": "//",
    "bulletSeparator": "- "
  }
},
...

Some live example here :

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants