Ver código fonte

url quote the str data passed to rx.download (#3381)

Masen Furer 1 ano atrás
pai
commit
51d3b2cb21
1 arquivos alterados com 2 adições e 1 exclusões
  1. 2 1
      reflex/event.py

+ 2 - 1
reflex/event.py

@@ -3,6 +3,7 @@
 from __future__ import annotations
 
 import inspect
+import urllib.parse
 from base64 import b64encode
 from typing import (
     Any,
@@ -665,7 +666,7 @@ def download(
 
         if isinstance(data, str):
             # Caller provided a plain text string to download.
-            url = "data:text/plain," + data
+            url = "data:text/plain," + urllib.parse.quote(data)
         elif isinstance(data, Var):
             # Need to check on the frontend if the Var already looks like a data: URI.
             is_data_url = data._replace(