Add CSS sanitization for image dimensions in HTML sanitization

This commit is contained in:
vvzvlad
2025-02-07 01:14:34 +03:00
parent 84dbfd2376
commit 0ea7717422
+4 -1
View File
@@ -226,7 +226,10 @@ class PostParser:
html,
tags=self.allowed_tags,
attributes=self.allowed_attributes,
strip=True
strip=True,
css_sanitizer=bleach.css_sanitizer.CSSSanitizer(
allowed_css_properties=['max-width', 'max-height', 'width', 'height', 'object-fit']
)
)
except Exception as e:
logger.error(f"html_sanitization_error: {str(e)}")