mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
Return tuple consistently and strip potential left string
This commit is contained in:
parent
5e35aab292
commit
168997a58e
@ -420,7 +420,7 @@ def load_b64_image_data(b64_str):
|
|||||||
try:
|
try:
|
||||||
if "," in b64_str:
|
if "," in b64_str:
|
||||||
header, encoded = b64_str.split(",", 1)
|
header, encoded = b64_str.split(",", 1)
|
||||||
mime_type = header.split(";")[0]
|
mime_type = header.split(";")[0].lstrip("data:")
|
||||||
img_data = base64.b64decode(encoded)
|
img_data = base64.b64decode(encoded)
|
||||||
else:
|
else:
|
||||||
mime_type = "image/png"
|
mime_type = "image/png"
|
||||||
@ -428,7 +428,7 @@ def load_b64_image_data(b64_str):
|
|||||||
return img_data, mime_type
|
return img_data, mime_type
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
log.exception(f"Error loading image data: {e}")
|
log.exception(f"Error loading image data: {e}")
|
||||||
return None
|
return None, None
|
||||||
|
|
||||||
|
|
||||||
def load_url_image_data(url, headers=None):
|
def load_url_image_data(url, headers=None):
|
||||||
|
Loading…
Reference in New Issue
Block a user