浏览代码

Merge pull request #10311 from alexgleason/fix-undefined-title

Fix "Cannot read properties of undefined (reading 'startsWith')"
Timothy Jaeryang Baek 2 月之前
父节点
当前提交
0b271d24d1
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2 2
      src/lib/components/chat/Messages/Markdown/Source.svelte

+ 2 - 2
src/lib/components/chat/Messages/Markdown/Source.svelte

@@ -2,7 +2,7 @@
 	export let token;
 	export let token;
 	export let onClick: Function = () => {};
 	export let onClick: Function = () => {};
 
 
-	let attributes: Record<string, string> = {};
+	let attributes: Record<string, string | undefined> = {};
 
 
 	function extractAttributes(input: string): Record<string, string> {
 	function extractAttributes(input: string): Record<string, string> {
 		const regex = /(\w+)="([^"]*)"/g;
 		const regex = /(\w+)="([^"]*)"/g;
@@ -42,6 +42,6 @@
 	}}
 	}}
 >
 >
 	<span class="line-clamp-1">
 	<span class="line-clamp-1">
-		{formattedTitle(attributes.title)}
+		{attributes.title ? formattedTitle(attributes.title) : ''}
 	</span>
 	</span>
 </button>
 </button>