From 40d4a1f81a7e948d42f684ff0f2afba642afd74b Mon Sep 17 00:00:00 2001 From: Tony Date: Tue, 12 Nov 2024 09:16:55 -0800 Subject: [PATCH] =?UTF-8?q?fix(route):=20=E4=BF=AE=E5=A4=8D=20=E9=83=A8?= =?UTF-8?q?=E5=88=86=E6=83=85=E5=86=B5=E4=B8=8B=20url.expanded=5Furl=20?= =?UTF-8?q?=E5=8F=AF=E8=83=BD=E4=B8=BA=20undefined=20=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#17560)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit fix #17382 Co-authored-by: CaoMeiYouRen <996881204@qq.com> --- lib/routes/twitter/utils.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/routes/twitter/utils.ts b/lib/routes/twitter/utils.ts index 387884ca2e73b2..f78534875bb124 100644 --- a/lib/routes/twitter/utils.ts +++ b/lib/routes/twitter/utils.ts @@ -35,7 +35,7 @@ const formatText = (item) => { const urls = item.entities.urls || []; for (const url of urls) { // trim link pointing to the tweet itself (usually appears when the tweet is truncated) - text = text.replaceAll(url.url, url.expanded_url.endsWith(id_str) ? '' : url.expanded_url); + text = text.replaceAll(url.url, url.expanded_url?.endsWith(id_str) ? '' : url.expanded_url); } const media = item.extended_entities?.media || []; for (const m of media) {