Skip to content

Commit

Permalink
Do not allow encode_url_to_base64 to encode error responses
Browse files Browse the repository at this point in the history
  • Loading branch information
akx committed Jun 27, 2023
1 parent fa0430e commit 91932b4
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion client/python/gradio_client/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ def encode_file_to_base64(f: str | Path):


def encode_url_to_base64(url: str):
encoded_string = base64.b64encode(requests.get(url).content)
resp = requests.get(url)
resp.raise_for_status()
encoded_string = base64.b64encode(resp.content)
base64_str = str(encoded_string, "utf-8")
mimetype = get_mimetype(url)
return (
Expand Down

0 comments on commit 91932b4

Please sign in to comment.