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:
Jakub Trllo 2025-11-19 14:04:33 +01:00 committed by GitHub
commit e90305d43f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -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")