Skip to content

fix: send CSV imports as JSON instead of multipart/form-data#1306

Open
jeremydw wants to merge 1 commit into
mainfrom
fix/csv-import-json
Open

fix: send CSV imports as JSON instead of multipart/form-data#1306
jeremydw wants to merge 1 commit into
mainfrom
fix/csv-import-json

Conversation

@jeremydw

Copy link
Copy Markdown
Member

Problem

The CMS translations CSV import (LocalizationModal) uploads the selected file to /cms/api/csv.import as multipart/form-data. Some production deployments sit behind WAFs/edge proxies that block multipart/form-data POSTs outright, so the request is rejected before it ever reaches the server and the import fails with an opaque error.

Change

  • csv.import now accepts a JSON body ({"csv": "<csv text>"}) in addition to the existing multipart/form-data upload (kept for backwards compatibility).
  • The CMS UI reads the selected file client-side (file.text()) and sends it as JSON.
  • /cms/api/csv.import is included in the routes that use the larger (4mb) body-parser JSON limit, matching the AI prepare routes, so larger translation CSVs are not rejected by the default 100kb limit.

Notes

  • CSV files are text, so file.text() + JSON encoding is lossless.
  • No API-consumer breakage: existing multipart clients continue to work; the response shape is unchanged.

🤖 Generated with Claude Code

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.

1 participant