diff --git a/files/helpers/sanitize.py b/files/helpers/sanitize.py
index f524897eb..9469908bd 100644
--- a/files/helpers/sanitize.py
+++ b/files/helpers/sanitize.py
@@ -215,6 +215,10 @@ def sanitize(sanitized, edit=False):
tag['alt'] = f'![]({tag["data-src"]})'
tag['referrerpolicy'] = "no-referrer"
+ a = soup.new_tag("a", href=tag["data-src"], rel="nofollow noopener noreferrer")
+ tag = tag.replace_with(a)
+ a.append(tag)
+
for tag in soup.find_all("a"):
if tag.get("href") and fishylinks_regex.fullmatch(str(tag.string)):
tag.string = tag["href"]
diff --git a/files/templates/chat.html b/files/templates/chat.html
index a2a6d1462..01b9a0617 100644
--- a/files/templates/chat.html
+++ b/files/templates/chat.html
@@ -199,7 +199,7 @@
{% include "emoji_modal.html" %}
{% include "expanded_image_modal.html" %}
-
+