diff --git a/app.py b/app.py
index d9f7f37..3fa98a8 100644
--- a/app.py
+++ b/app.py
@@ -57,7 +57,7 @@ class Message(db.Model):
return self.token_count
def is_base64_image(self):
- return '
{
const newMessage = document.createElement("p");
// Check if the username is present and prepend it to the message content
const messageContent = data.username ? `**${data.username}:**\n\n${data.content}` : data.content;
- newMessage.innerHTML = DOMPurify.sanitize(marked.marked(messageContent), dompurify_config);
+
+ // Check if the message starts with a base64 image tag
+ if (data.content.startsWith('
{
messageWrapper.id = "message-" + data.id;
const newMessage = document.createElement("p");
- newMessage.innerHTML = DOMPurify.sanitize(marked.marked(`**${data.username}:**\n\n${data.message}`), dompurify_config);
+
+ // Check if the message contains a base64 image
+ if (data.message.startsWith(') {
+ // Directly assign the message as innerHTML if it's a base64 image
+ newMessage.innerHTML = data.message;
+ } else {
+ // Otherwise, sanitize and process the message with marked
+ newMessage.innerHTML = DOMPurify.sanitize(marked.marked(`**${data.username}:**\n\n${data.message}`), dompurify_config);
+ }
// Create the delete button
const deleteButton = document.createElement()