superset icon indicating copy to clipboard operation
superset copied to clipboard

fix(Dashboard): PDF/Image download CORS issues via image proxy

Open geido opened this issue 1 year ago • 0 comments

SUMMARY

A dashboard can have an image attached in the markdown component that is hosted on a server that does not have proper CORS settings. Due to limitations of html2canvas, both PDF and image download will fail.

For reference from html2canvas:

All the images that the script uses need to reside under the same origin for it to be able to read them without the assistance of a proxy. Similarly, if you have other canvas elements on the page, which have been tainted with cross-origin content, they will become dirty and no longer readable by html2canvas.

This PR introduces an img_proxy view that can be used to overcome the CORS issues.

BEFORE/AFTER SCREENSHOTS OR ANIMATED GIF

N.A.

TESTING INSTRUCTIONS

  1. Attach an image in the dashboard that does not have proper CORS settings
  2. Download the dashboard as PDF or image

ADDITIONAL INFORMATION

  • [ ] Has associated issue:
  • [ ] Required feature flags:
  • [ ] Changes UI
  • [ ] Includes DB Migration (follow approval process in SIP-59)
    • [ ] 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

geido avatar Apr 29 '24 12:04 geido