mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
safe guard downloading of image for ayon_url
This commit is contained in:
parent
b684ba5ef0
commit
2af5e918a7
1 changed files with 11 additions and 5 deletions
|
|
@ -548,11 +548,17 @@ class _IconsCache:
|
|||
elif icon_type == "ayon_url":
|
||||
url = icon_def["url"].lstrip("/")
|
||||
url = f"{ayon_api.get_base_url()}/{url}"
|
||||
stream = io.BytesIO()
|
||||
ayon_api.download_file_to_stream(url, stream)
|
||||
pix = QtGui.QPixmap()
|
||||
pix.loadFromData(stream.getvalue())
|
||||
icon = QtGui.QIcon(pix)
|
||||
try:
|
||||
stream = io.BytesIO()
|
||||
ayon_api.download_file_to_stream(url, stream)
|
||||
pix = QtGui.QPixmap()
|
||||
pix.loadFromData(stream.getvalue())
|
||||
icon = QtGui.QIcon(pix)
|
||||
except Exception:
|
||||
log.warning(
|
||||
"Failed to download image '%s'", url, exc_info=True
|
||||
)
|
||||
icon = None
|
||||
|
||||
elif icon_type == "transparent":
|
||||
size = icon_def.get("size")
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue