diff --git a/extensions/gallery/script.py b/extensions/gallery/script.py
index f14dfd76..5c47f0f1 100644
--- a/extensions/gallery/script.py
+++ b/extensions/gallery/script.py
@@ -66,13 +66,7 @@ def generate_html():
container_html = '
'
image_html = "
"
- for i in [
- f"characters/{character}.png",
- f"characters/{character}.jpg",
- f"characters/{character}.jpeg",
- ]:
-
- path = Path(i)
+ for path in [Path(f"characters/{character}.{extension}") for extension in ['png', 'jpg', 'jpeg']]:
if path.exists():
image_html = f'
'
break