Skip to content

Commit

Permalink
fix(route): 修复 部分情况下 url.expanded_url 可能为 undefined 的问题 (DIYgod#17560)
Browse files Browse the repository at this point in the history
fix DIYgod#17382

Co-authored-by: CaoMeiYouRen <[email protected]>
  • Loading branch information
TonyRL and CaoMeiYouRen authored Nov 12, 2024
1 parent d10cd08 commit 40d4a1f
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/routes/twitter/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 40d4a1f

Please sign in to comment.