Closed Kory291 closed 1 month ago
AFAIK that should be the case. Download button should be visible when embedding large data.
One idea that comes to mind is that we are checking with mime type text number of lines, and your data is a single line, or perhaps there is an edge case with compressed data which comes from java script. What do you think @fpokryvk
An example how to reproduce would be welcome.
For example I did the following to provoke this:
long_data = "foo".join(["bar" for _ in range(1024*1024)])
context.formatter.embed(data=long_data, mime_type="text/plain", caption="download button", download_button=True)
context.formatter.embed(data=long_data, mime_type="text/plain", caption="no download button")
Could you provide more specific info (type of embeded data, size), in our case the data compression works fine (I have reports with 50MB of linux journal compressed to few hundreds of kB) and Download button is there.
I guess @modehnal was right. When I change it to use new lines, it adds the download button in both scenarios. The type of data would be html. If it is helpful for you, I could also provide an example using plotly (this was the specific use case where I first found this behaviour.).
Aha, I see, there is condition of 20 lines to show Download button, but it is probably not overriden by compression - I will investigate deeper and fix. Thanks for the report!
Tag 1.12 was created and pushed, updated version should be in pypi shortly. Please give it a try.
If you try to embed data without specifying
download_button=True
when usingembed()
you will get the standard message "Compressed data are too big, click download above." but it will not show the download button. Either the message in the report should be adjusted or the download button should be visible if the compressed data is too big.