fix(webui): handle undefined language in code blocks

When fenced code blocks have no language specifier, react-syntax-highlighter
receives undefined for the language prop, causing a white screen crash.

- CodeBlock.tsx: fallback to 'text' when language is undefined
- MarkdownTextRenderer.tsx: defensive fallback at fence rendering site
- Added test cases for both components

Fixes #4116
This commit is contained in:
Flinn-X
2026-05-31 15:42:40 +08:00
committed by Xubin Ren
parent a3241c33ba
commit bdb3a2ded7
4 changed files with 29 additions and 2 deletions
+1 -1
View File
@@ -33,7 +33,7 @@ const LazyHighlightedCode = lazy(async () => {
default({ language, code, isDark }: HighlightedCodeProps) {
return (
<SyntaxHighlighter
language={language}
language={language || "text"}
style={isDark ? oneDark : oneLight}
customStyle={{
margin: 0,