rusackas opened a new pull request, #42193:
URL: https://github.com/apache/superset/pull/42193
### SUMMARY
Chart data exports (CSV/XLSX/zip) from `/api/v1/chart/data` were always
named with a bare timestamp (e.g. `20260127_160233.csv`), even though the
endpoint already extracts a sanitized `filename` from the request. Only
the large-dataset *streaming* CSV path honored that filename (and its
chart-name-based fallback); the regular non-streaming CSV, XLSX, and
multi-query zip branches in `_send_chart_response` called
`generate_download_headers()` with no filename at all, dropping it on the
floor.
This PR:
- Passes the extracted `filename` through to `generate_download_headers()`
in the CSV, XLSX, and zip branches.
- When no filename is supplied, falls back to the same chart-name +
timestamp default already used by the streaming CSV path (extracted into
a shared `_get_default_export_filename` helper to avoid duplicating that
logic).
- Report/email attachments already use the report name, so this change is
scoped to the chart data export endpoints only.
### BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF
N/A (backend header change only)
### TESTING INSTRUCTIONS
1. Open any saved chart in Explore.
2. Use Download → Export to CSV (or Excel).
3. Confirm the downloaded filename starts with the chart's name instead of
just a timestamp.
Also see the added unit tests in
`tests/unit_tests/charts/test_chart_data_api.py`, which pin the bug by
asserting the `Content-Disposition` header contains the chart name for
the CSV, XLSX, and zip export branches.
### ADDITIONAL INFORMATION
- [x] Has associated issue: Fixes #37487
- [ ] Required feature flags:
- [ ] Changes UI
- [ ] Includes DB Migration (follow approval process in
[SIP-59](https://github.com/apache/superset/issues/13351))
- [ ] Migration is atomic, supports rollback & is backwards-compatible
- [ ] Confirm DB migration upgrade and downgrade tested
- [ ] Runtime estimates and downtime expectations provided
- [ ] Introduces new feature or API
- [ ] Removes existing feature or API
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]