mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 12:54:40 +01:00
Merge pull request #1555 from ynput/bugfix/safe-guard-ayon-url
UI Icons: Safe guard downloading of image for AYON
This commit is contained in:
commit
e90305d43f
1 changed files with 11 additions and 5 deletions
|
|
@ -548,11 +548,17 @@ class _IconsCache:
|
||||||
elif icon_type == "ayon_url":
|
elif icon_type == "ayon_url":
|
||||||
url = icon_def["url"].lstrip("/")
|
url = icon_def["url"].lstrip("/")
|
||||||
url = f"{ayon_api.get_base_url()}/{url}"
|
url = f"{ayon_api.get_base_url()}/{url}"
|
||||||
stream = io.BytesIO()
|
try:
|
||||||
ayon_api.download_file_to_stream(url, stream)
|
stream = io.BytesIO()
|
||||||
pix = QtGui.QPixmap()
|
ayon_api.download_file_to_stream(url, stream)
|
||||||
pix.loadFromData(stream.getvalue())
|
pix = QtGui.QPixmap()
|
||||||
icon = QtGui.QIcon(pix)
|
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":
|
elif icon_type == "transparent":
|
||||||
size = icon_def.get("size")
|
size = icon_def.get("size")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue