Chore: Import lxml lazily in the SVG validator

This commit is contained in:
Trenton H committed 2026-10-30 10:21:49 -07:00
1 parent bc051a4ce3
commit 06cd62170d
1 file changed
+1 -1
+1 -1
View File
@@ -3,7 +3,6 @@ from io import BytesIO
from django.conf import settings
from django.core.exceptions import ValidationError
from django.core.files.uploadedfile import UploadedFile
from lxml import etree
from PIL import Image
ALLOWED_SVG_TAGS: set[str] = {
@@ -186,6 +185,7 @@ def reject_dangerous_svg(file: UploadedFile) -> None:
Raises ValidationError if unsafe content is found.
See GHSA-6p53-hqqw-8j62
"""
from lxml import etree
try:
parser = etree.XMLParser(resolve_entities=False)