소스 검색

fix: view workflow log detail page crash (#5474)

Joel 10 달 전
부모
커밋
e88f5607ac
1개의 변경된 파일5개의 추가작업 그리고 2개의 파일을 삭제
  1. 5 2
      web/app/components/base/markdown.tsx

+ 5 - 2
web/app/components/base/markdown.tsx

@@ -40,9 +40,12 @@ const getCorrectCapitalizationLanguageName = (language: string) => {
   return language.charAt(0).toUpperCase() + language.substring(1)
   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}$`)
     .replace(/\\\((.*?)\\\)/gs, (_, equation) => `$${equation}$`)
+}
 
 
 export function PreCode(props: { children: any }) {
 export function PreCode(props: { children: any }) {
   const ref = useRef<HTMLPreElement>(null)
   const ref = useRef<HTMLPreElement>(null)