fix(route/picnob/user): missing linebreak (#16608)

Signed-off-by: Rongrong <i@rong.moe>
This commit is contained in:
Rongrong 2024-09-03 03:08:00 +08:00 committed by GitHub
parent 8f073e0ab4
commit b5ad2fa0cb
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 11 additions and 3 deletions

View File

@ -82,7 +82,8 @@ async function handler(ctx) {
const list = await Promise.all(
posts.items.map(async (item) => {
const { shortcode, type, sum_pure, time } = item;
const { shortcode, sum, type, time } = item;
const link = `${baseUrl}/post/${shortcode}/`;
if (type === 'img_multi') {
item.images = await cache.tryGet(link, async () => {
@ -111,8 +112,15 @@ async function handler(ctx) {
}
return {
title: sum_pure,
description: art(path.join(__dirname, 'templates/desc.art'), { item }),
// sum_pure lacks linebreaks/spaces between lines
title: load(sum, null, false).text().replaceAll('\n', ' '),
description: art(path.join(__dirname, 'templates/desc.art'), {
item: {
...item,
// Fix linebreaks
sum: sum.replaceAll('\n', '<br>'),
},
}),
link,
pubDate: parseDate(time, 'X'),
};