Skip to content

Commit

Permalink
fix(/mittrchina/breaking): TypeError: Cannot read properties of null …
Browse files Browse the repository at this point in the history
…(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
  • Loading branch information
defp authored Dec 11, 2024
1 parent c876e39 commit ab760e9
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions lib/routes/mittrchina/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 () => {
Expand Down

0 comments on commit ab760e9

Please sign in to comment.