From ab760e9305fb45dd2fea118826e330ec485215bb Mon Sep 17 00:00:00 2001
From: lidashuang
Date: Wed, 11 Dec 2024 17:13:41 +0800
Subject: [PATCH] fix(/mittrchina/breaking): TypeError: Cannot read properties
of null (reading 'content') (#17855)
* feat(route): add amz123.com
* fix(/mittrchina/breaking): check var null
TypeError: Cannot read properties of null (reading 'content')
* fix(/mittrchina): breaking url null properties
---
lib/routes/mittrchina/index.ts | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/routes/mittrchina/index.ts b/lib/routes/mittrchina/index.ts
index d9e30b686..ef392a47e 100644
--- a/lib/routes/mittrchina/index.ts
+++ b/lib/routes/mittrchina/index.ts
@@ -82,14 +82,16 @@ async function handler(ctx) {
type: article.address.split('.').pop(),
},
})
- : article.summary,
- pubDate: article.start_time ? parseDate(article.start_time, 'X') : undefined,
+ : type === 'breaking'
+ ? article.content
+ : article.summary,
+ pubDate: article.start_time ? parseDate(article.start_time, 'X') : article.push_time ? parseDate(article.push_time, 'X') : undefined,
id: article.id,
link: `https://www.mittrchina.com/news/detail/${article.id}`,
}));
let items = list;
- if (type !== 'video') {
+ if (type !== 'video' && type !== 'breaking') {
items = await Promise.all(
list.map((item) =>
cache.tryGet(item.link, async () => {