codeant-ai-for-open-source[bot] commented on code in PR #44529:
URL: https://github.com/apache/superset/pull/44529#discussion_r4098553728


##########
superset-frontend/src/utils/downloadAsImage.tsx:
##########
@@ -559,14 +571,36 @@ export default function downloadAsImageOptimized(
           }),
         };
 
-        const dataUrl = isPng
-          ? await domToImage.toPng(agRootWrapper, agImageOptions)
-          : await domToImage.toJpeg(agRootWrapper, agImageOptions);
+        let dataUrl: string;
+        if (isSafari()) {
+          // `dom-to-image-more` relies on SVG <foreignObject>, which WebKit 
does
+          // not reliably paint. Keep the ag-grid preparation above, then use a
+          // DOM painter for the actual Safari capture.
+          const { default: html2canvas } = await import('html2canvas');
+          const canvas = await html2canvas(agRootWrapper, {
+            backgroundColor:
+              bgcolor === TRANSPARENT_RGBA ? null : (bgcolor ?? null),
+            height: imageHeight,
+            width: originalWidth,
+            scale,
+            useCORS: true,

Review Comment:
   ✅ **Customized review instruction saved!**
   
   **Instruction:**
   > Do not flag omission of inaccessible cross-origin images in Safari canvas 
exports; without CORS headers they cannot be safely rendered, and allowing 
tainted images would break the entire download.
   
   **Applied to:**
     - `superset-frontend/src/utils/downloadAsImage.tsx`
   
   ---
   💡 *To manage or update this instruction, visit: [CodeAnt AI 
Settings](https://app.codeant.ai/org/settings/learnings)*



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