Bug description
Steps to reproduce
- Create table chart
- Enable server pagination
- Create email report
- Set Content Format to "Send as CSV"
Actual Result
Getting an email with "csv" attachment but file is really a "zip".
Expected Result
Attachment should have "zip" extension.
Potential cause
It is because server pagination executes two queries, and results is downloaded as zip file.
Screenshots/recordings
Superset version
4.1.2
Python version
3.9
Node version
16
Browser
Firefox
Additional context
No response
Checklist
- [x] I have searched Superset docs and Slack and didn't find a solution to my problem.
- [x] I have searched the GitHub issue tracker and didn't find a similar bug report.
- [x] I have checked Superset's logs for errors and if I found a relevant Python stacktrace, I included it here as text in the "additional context" section.
Comment From: dosubot[bot]
Hello @Regonos! I'm here to help you with any issues you encounter. I can assist with bug resolution, answer your questions, and guide you to become a contributor.
The issue you're experiencing with the email report attachment having the wrong file extension is likely due to the way Superset handles multiple query results. When server pagination is enabled, it can result in multiple queries being executed, which leads to the results being bundled into a ZIP file. However, the attachment is still being labeled with a .csv
extension instead of .zip
.
The logic for compressing multiple query results into a ZIP file is found in the superset/charts/data/api.py
file. Specifically, when there are multiple queries, the results are bundled as a ZIP file [1].
To resolve this issue, you would need to ensure that the file extension in the email report matches the actual file format. This might involve modifying the logic that assigns the file extension in the Content-Disposition
header of the email attachment. The relevant code for setting the file extension is located in the superset/utils/core.py
file, where the filename
parameter is set [2].
You may need to adjust the code to correctly set the file extension based on whether the results are being compressed into a ZIP file or not.
To continue talking to Dosu, mention @dosu.
Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other
Comment From: rusackas
Seems to be a duplicate of https://github.com/apache/superset/issues/25647?
Comment From: rusackas
I think this one is resolved... at least I tried to reproduce it on the other thread and couldn't. Can anyone check on latest master
?