kokhlo opened a new pull request, #44310:
URL: https://github.com/apache/superset/pull/44310

   ### Summary
   Backport of #43185 to the `6.1` release branch: export downloads 
(chart/dashboard/dataset/database/assets/saved-queries/themes) stop inheriting 
Superset's one-year `SEND_FILE_MAX_AGE_DEFAULT` and are served with `max_age=0` 
+ `no-store`/`no-cache`/`must-revalidate` instead.
   
   This is the concrete user-facing reproduction behind the umbrella issue 
#41687 on 6.1: renaming a chart and re-exporting it without a page refresh 
returns the year-cached ZIP built before the rename — the export URL is keyed 
only by chart IDs, so it is byte-identical after a rename (reported today as 
#44306).
   
   ### Changes
   - `superset/utils/core.py`: `send_export_zip()` helper (from #43185) + 
`COOKIE_TOKEN_RE` / `sanitize_cookie_token()` which the helper calls on 
`master` (added there by an earlier change, missing on `6.1`) — cherry-pick 
alone would raise `NameError` here.
   - 7 export endpoints switch from raw `send_file(...)` to 
`send_export_zip(buf, filename)`, preserving the `token` download-completion 
cookie behavior.
   - `tests/unit_tests/utils/send_export_zip_tests.py`: unit tests from #43185.
   - Conflicts resolved by keeping the `6.1` import style (`prison`, `rison` 
instead of `parse_rison`) and dropping `master`-only imports 
(`superset.versioning.*`) that don't exist on this branch; the endpoint bodies 
take the #43185 form.
   
   ### Verification
   - Both branch tips (`6.1` and `6.2`) verified to still contain the raw 
un-cached `send_file` before this change.
   - Behavioral check of the backported helper in a Flask test request context: 
`Cache-Control: no-store, no-cache, must-revalidate, max-age=0`, named 
`attachment` ZIP, `token` echoed as cookie, unsafe token (`%0d%0a`) rejected. 
Pre-change path reproduces `Cache-Control: public, max-age=31536000`.
   - `ruff check` clean on all touched files.
   
   Companion backport to `6.2`: TBD (will link).


-- 
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]

Reply via email to