From 0ad858912221808e44a63f8f1f87aa20138f7db8 Mon Sep 17 00:00:00 2001 From: Russell Ballestrini Date: Sat, 4 Nov 2023 09:47:37 -0400 Subject: [PATCH] allow images modified: app.py --- app.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app.py b/app.py index 56e9749..461c215 100644 --- a/app.py +++ b/app.py @@ -53,10 +53,11 @@ def escape_except_code_and_pre(html_content): html_str = str(soup) # Define bleach settings to allow iframes - tags = list(bleach.sanitizer.ALLOWED_TAGS) + ["iframe"] + tags = list(bleach.sanitizer.ALLOWED_TAGS) + ["iframe", "img"] attributes = { **bleach.sanitizer.ALLOWED_ATTRIBUTES, "iframe": ["src", "width", "height", "frameborder", "allow", "allowfullscreen"], + "img": ["src", "alt", "width", "height", "title"], } # Sanitize the content using bleach