mirror of
https://github.com/open-webui/open-webui
synced 2025-02-23 05:38:41 +00:00
Check is response is OK from retrieve the picture if not then default
This commit is contained in:
parent
14398ab628
commit
546ef6ab42
@ -261,6 +261,7 @@ class OAuthManager:
|
||||
}
|
||||
async with aiohttp.ClientSession() as session:
|
||||
async with session.get(picture_url, **get_kwargs) as resp:
|
||||
if resp.ok:
|
||||
picture = await resp.read()
|
||||
base64_encoded_picture = base64.b64encode(
|
||||
picture
|
||||
@ -270,6 +271,8 @@ class OAuthManager:
|
||||
# assume JPG, browsers are tolerant enough of image formats
|
||||
guessed_mime_type = "image/jpeg"
|
||||
picture_url = f"data:{guessed_mime_type};base64,{base64_encoded_picture}"
|
||||
else:
|
||||
picture_url = "/user.png"
|
||||
except Exception as e:
|
||||
log.error(
|
||||
f"Error downloading profile image '{picture_url}': {e}"
|
||||
|
Loading…
Reference in New Issue
Block a user