Shared task board where people and AI coding agents work as teammates. Source-available, self-hostable.
Go
fix(markdown): allow mention:// protocol through URL sanitization
Jiang Bohanc5b0535a3f33
diff --git a/apps/web/components/markdown/Markdown.tsx b/apps/web/components/markdown/Markdown.tsxindex 77f5710b2e..c10fccb346 100644--- a/apps/web/components/markdown/Markdown.tsx+++ b/apps/web/components/markdown/Markdown.tsx@@ -1,6 +1,6 @@import * as React from 'react'import Link from 'next/link'-import ReactMarkdown, { type Components } from 'react-markdown'+import ReactMarkdown, { type Components, defaultUrlTransform } from 'react-markdown'import rehypeRaw from 'rehype-raw'import remarkGfm from 'remark-gfm'import { cn } from '@/lib/utils'@@ -44,6 +44,15 @@ export interface MarkdownProps {onFileClick?: (path: string) => void}+/**+ * Custom URL transform that allows mention:// protocol (used for @mentions)+ * while keeping the default security for all other URLs.+ */+function urlTransform(url: string): string {+ if (url.startsWith('mention://')) return url+ return defaultUrlTransform(url)+}+// File path detection regex - matches paths starting with /, ~/, or ./const FILE_PATH_REGEX =/^(?:\/|~\/|\.\/)[\w\-./@]+\.(?:ts|tsx|js|jsx|mjs|cjs|md|json|yaml|yml|py|go|rs|css|scss|less|html|htm|txt|log|sh|bash|zsh|swift|kt|java|c|cpp|h|hpp|rb|php|xml|toml|ini|cfg|conf|env|sql|graphql|vue|svelte|astro|prisma)$/i@@ -298,6 +307,7 @@ export function Markdown({<ReactMarkdownremarkPlugins={[[remarkGfm, { singleTilde: false }]]}rehypePlugins={[rehypeRaw]}+ urlTransform={urlTransform}components={components}>{processedContent}