fix: for list of images, remove empty strings (#2634)

* For list of images, remove empty strings

* Fix formatting

---------

Co-authored-by: Michael Genson <71845777+michael-genson@users.noreply.github.com>
This commit is contained in:
boc-the-git 2023-10-16 07:32:51 +11:00 committed by GitHub
parent f72fcc3031
commit cb1769a352
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,7 +102,7 @@ def clean_image(image: str | list | dict | None = None, default: str = "no image
case str(image):
return [image]
case [str(_), *_]:
return image
return [x for x in image if x] # Only return non-null strings in list
case [{"url": str(_)}, *_]:
return [x["url"] for x in image]
case {"url": str(image)}: