fix(route): 修复 部分情况下 url.expanded_url 可能为 undefined 的问题 (#17560)

fix #17382

Co-authored-by: CaoMeiYouRen <996881204@qq.com>
This commit is contained in:
Tony
2024-11-12 09:16:55 -08:00
committed by GitHub
parent d10cd08e04
commit 40d4a1f81a
+1 -1
View File
@@ -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) {