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

Sanitize comma-separated fields #68

Open
leendertvanwolfswinkel opened this issue Jul 1, 2024 · 0 comments
Open

Sanitize comma-separated fields #68

leendertvanwolfswinkel opened this issue Jul 1, 2024 · 0 comments
Assignees

Comments

@leendertvanwolfswinkel
Copy link

leendertvanwolfswinkel commented Jul 1, 2024

Some fields, such as time series fields, tags, and friction_values, contain comma-separated values.

If users have some spaces, newlines, tabs etc. in these, it fails. We could pretty easily sanitize these inputs before parsing them, saving our users a lot of hassle.

Fields involved

class field expected
Lateral2D timeseries comma separated numbers
BoundaryConditions2D timeseries comma separated numbers
Lateral1d timeseries comma separated numbers
BoundaryCondition1D timeseries comma separated numbers
many tags comma separated numbers
ControlTable action_table comma separated table
DryWeatherFlowDistribution distribution comma separated numbers
CrossSectionLocation cross_section_friction_values comma separated numbers
CrossSectionLocation cross_section_vegetation_table comma separated table
CrossSectionLocation cross_section_table comma separated table
Pipe cross_section_table comma separated table
Culvert cross_section_table comma separated table
Weir cross_section_table comma separated table
Orifice cross_section_table comma separated table

Actions for comma separated strings

Remove white space surrounding , and remove leading and trailing white spaces, including tabs and new lines

  • 1,2,3 -> 1,2,3
  • 1, 2, 3 -> 1,2,3
  • 1 2 3 -> 1 2 3
  • 1,2, 3 -> 1,2,3
  • 1,\t2,\t3\n -> 1,2,3

Actions for tables

Remove leading and trailing white space and then do the above for every item

@margrietpalm margrietpalm self-assigned this Dec 9, 2024
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

2 participants