rusackas commented on code in PR #43504:
URL: https://github.com/apache/superset/pull/43504#discussion_r3943101594


##########
superset/views/base.py:
##########
@@ -812,6 +813,14 @@ def get_spa_template_context(
         # No custom URL either, use default SVG
         spinner_svg = get_default_spinner_svg()
 
+    # Serve the spinner as an <img> data URI (see spa.html). SVG loaded via 
<img>
+    # can't execute scripts, so rendering doesn't depend on 
sanitize_svg_content.
+    spinner_svg_data_uri = None
+    if spinner_svg:
+        spinner_svg_data_uri = "data:image/svg+xml;base64," + base64.b64encode(
+            spinner_svg.encode("utf-8")
+        ).decode("ascii")

Review Comment:
   @n4uu one more vote for an `isinstance(svg, str)` guard in 
`_svg_to_data_uri`... I don't think a non-string can get in through the UI, but 
a hand-edited theme in config or the DB would 500 every page load here, where 
master would have just rendered it as junk text. Cheap to guard, and worth a 
tiny test alongside it.
   



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