diff --git a/lib/routes/jike/user.js b/lib/routes/jike/user.js
index a5470d9079..34e75a8e78 100644
--- a/lib/routes/jike/user.js
+++ b/lib/routes/jike/user.js
@@ -49,10 +49,12 @@ module.exports = async (ctx) => {
});
let content = item.content || (item.linkInfo && item.linkInfo.title) || (item.question && item.question.title) || item.title || '';
+ content = content.replace(/\r\n|\n|\r/g, '
');
let shortenTitle = '一条动态';
if (content) {
shortenTitle = content.length > 75 ? `${content.substr(0, 75)}...` : content;
+ shortenTitle = shortenTitle.replace(/(
)+/g, ' ');
content = `${content}
`;
}
@@ -65,8 +67,8 @@ module.exports = async (ctx) => {
repostImgTemplate += `
`;
});
- const repostContent = `转发 ${screenNameTemplate}: ${item.target.content}${repostImgTemplate}`;
- content = `${content}${repostContent}`.replace(/\n|\r/g, '
');
+ const repostContent = `转发 ${screenNameTemplate}: ${item.target.content}${repostImgTemplate}`.replace(/\r\n|\n|\r/g, '
');
+ content = `${content}${repostContent}`;
}
// 部分功能未知
/* else if (item.type === 'ANSWER') {
@@ -101,7 +103,7 @@ module.exports = async (ctx) => {
const single = {
title: `${typeMap[item.type]}了: ${shortenTitle}`,
- description: `${content}${linkTemplate}${imgTemplate}`,
+ description: `${content}${linkTemplate}${imgTemplate}`.replace(/(
|\s)+$/, ''),
pubDate: new Date(item.createdAt).toUTCString(),
link: linkMap[item.type],
};