Skip to content

Conversation

@lkssmnt
Copy link
Contributor

@lkssmnt lkssmnt commented Nov 20, 2025

Fix CSV export escaping and normalize field parsing in Request::download()

Changes:

  • Replace semicolon joins with a robust csvLine() helper that correctly escapes delimiters, quotes and newlines.
  • Normalize field values before CSV export
  • Replace the inline parseField() function with a local closure $parseField for clearer scoping.
  • Build header and rows using the new csvLine() helper to ensure correct escaping for all fields.

Why:

  • The previous implementation used raw string joins (A::join([...], ';')) which failed to escape semicolons, quotes and embedded newlines inside field values. This produced invalid CSV when fields contained those characters or complex types (arrays/objects).
  • The new approach ensures exports are RFC-compatible for common CSV readers and handles more data types reliably.

Testing / QA steps:

  1. Create a form submission with:
  • Fields containing semicolons and quotes
  • Fields containing CRLF/newlines
  • Array field values and nested objects (where applicable)
  • Boolean and null values
  1. Download the CSV via the existing UI/action that triggers Request::download().
  2. Open and verify the exported CSV

@lkssmnt lkssmnt closed this Nov 20, 2025
@lkssmnt lkssmnt reopened this Nov 20, 2025
@plain-solutions-gmbh plain-solutions-gmbh merged commit 03defa6 into plain-solutions-gmbh:main Nov 20, 2025
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

Successfully merging this pull request may close these issues.

2 participants