From 0c02303254aafd3385e6beed5ae33c1037863efc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=87=89=E5=87=89?= Date: Mon, 14 Jan 2019 00:18:58 +0800 Subject: [PATCH] Hotfix: twitter wrap (#1384) Closes #1382 --- lib/routes/twitter/utils.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/routes/twitter/utils.js b/lib/routes/twitter/utils.js index f7a1b3882..b97cf990d 100644 --- a/lib/routes/twitter/utils.js +++ b/lib/routes/twitter/utils.js @@ -25,7 +25,7 @@ const ProcessFeed = ({ data = [] }) => { } }; - const formatText = (text) => text.replace(/https:\/\/t\.co(.*)/g, ''); + const formatText = (text) => text.replace(/https:\/\/t\.co(.*)/g, '').replace(/\n/g, '
'); const formatVideo = (media) => { let content = ''; const video = media.video_info.variants.reduce((video, item) => { @@ -97,8 +97,8 @@ const ProcessFeed = ({ data = [] }) => { } return { - title: `${item.in_reply_to_screen_name ? 'Re ' : ''}${item.full_text}`, - description: `${item.in_reply_to_screen_name ? 'Re ' : ''}${item.full_text}${url}${img}${quote}`, + title: `${item.in_reply_to_screen_name ? 'Re ' : ''}${formatText(item.full_text)}`, + description: `${item.in_reply_to_screen_name ? 'Re ' : ''}${formatText(item.full_text)}${url}${img}${quote}`, pubDate: new Date(item.created_at).toUTCString(), link: `https://twitter.com/${item.user.screen_name}/status/${item.id_str}`, };