From a547e382fd010c81745caf60a26be2d28846a890 Mon Sep 17 00:00:00 2001
From: HappyZhu99 <52676282+HappyZhu99@users.noreply.github.com>
Date: Tue, 21 Oct 2025 01:29:39 +0800
Subject: [PATCH] fix(route/sciencedirect): fix that abstract will not show
when highlights appear (#20333)
* fix(route/sciencedirect): fix abstract will not show when highlights appear
now both abstract and highlights will show. only abstract will be shown when there is no highlights for the paper
* Update current-issue.ts
* fix(route/sciencedirect): fix vary length of abstract array
---
lib/routes/sciencedirect/current-issue.ts | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/lib/routes/sciencedirect/current-issue.ts b/lib/routes/sciencedirect/current-issue.ts
index b031b4903..6657e61cb 100644
--- a/lib/routes/sciencedirect/current-issue.ts
+++ b/lib/routes/sciencedirect/current-issue.ts
@@ -76,8 +76,14 @@ async function handler(ctx) {
},
});
- item.description = response.data[0].abstracts[0].html ?? '';
-
+ const abstracts = response.data?.[0]?.abstracts ?? [];
+ item.description =
+ abstracts.length === 0
+ ? ''
+ : abstracts
+ .map((abs) => abs?.html ?? '')
+ .filter(Boolean)
+ .join('
');
return item;
})
)