"""Tests for write_gallery HTML escaping (fixes #12538 - stored XSS)."""
import tempfile
from pathlib import Path
from gen import write_gallery
def test_write_gallery_escapes_prompt_xss():
with tempfile.TemporaryDirectory() as tmpdir:
out = Path(tmpdir)
items = [{"prompt": '', "file": "001-test.png"}]
write_gallery(out, items)
html = (out / "index.html").read_text()
assert "