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
This commit is contained in:
HappyZhu99 2025-10-21 01:29:39 +08:00 committed by GitHub
parent 09a1afb05e
commit a547e382fd
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -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('<br/><br/>');
return item;
})
)