From e88f5607ac1884d4cfda2da46c82cc6d26598593 Mon Sep 17 00:00:00 2001 From: Joel Date: Fri, 21 Jun 2024 14:46:06 +0800 Subject: [PATCH] fix: view workflow log detail page crash (#5474) --- web/app/components/base/markdown.tsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/web/app/components/base/markdown.tsx b/web/app/components/base/markdown.tsx index 3548232ad3..fe55f6c8f1 100644 --- a/web/app/components/base/markdown.tsx +++ b/web/app/components/base/markdown.tsx @@ -40,9 +40,12 @@ const getCorrectCapitalizationLanguageName = (language: string) => { return language.charAt(0).toUpperCase() + language.substring(1) } -const preprocessLaTeX = (content: string) => - content.replace(/\\\[(.*?)\\\]/gs, (_, equation) => `$$${equation}$$`) +const preprocessLaTeX = (content: string) => { + if (typeof content !== 'string') + return content + return content.replace(/\\\[(.*?)\\\]/gs, (_, equation) => `$$${equation}$$`) .replace(/\\\((.*?)\\\)/gs, (_, equation) => `$${equation}$`) +} export function PreCode(props: { children: any }) { const ref = useRef(null)