Skip to content

Papermark is the open-source DocSend alternative and secure data rooms with built-in analytics and custom domains.

Potential fix for code scanning alert no. 92: Incomplete string escaping or encoding

Marc Seitzd4b32376ea1c
diff --git a/ee/features/ai/lib/chat/send-message.ts b/ee/features/ai/lib/chat/send-message.ts
index 348da2f9..d705aa5b 100644
--- a/ee/features/ai/lib/chat/send-message.ts
+++ b/ee/features/ai/lib/chat/send-message.ts
@@ -176,7 +176,10 @@ function stripTrailingReferencesSection(text: string): string {
}
function escapeMarkdownLinkText(value: string): string {
- return value.replace(/\[/g, "\\[").replace(/\]/g, "\\]");
+ return value
+ .replace(/\\/g, "\\\\")
+ .replace(/\[/g, "\\[")
+ .replace(/\]/g, "\\]");
}
async function resolveReferencesFromCitations({