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

This commit is contained in:
Masen Furer 2024-05-24 09:44:09 -07:00 committed by GitHub
parent 653f00b046
commit 51d3b2cb21
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

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