From 1bb5021c5479ad4a6bfad2714a4a4f2b6ba02493 Mon Sep 17 00:00:00 2001 From: dakkar Date: Sat, 3 Feb 2024 12:05:08 +0000 Subject: [PATCH] decode entity references from tweets MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit apparently *some* tweets have those ☹ --- .../src/queue/processors/ImportNotesProcessorService.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/backend/src/queue/processors/ImportNotesProcessorService.ts b/packages/backend/src/queue/processors/ImportNotesProcessorService.ts index 2476f94359..44c92fabb6 100644 --- a/packages/backend/src/queue/processors/ImportNotesProcessorService.ts +++ b/packages/backend/src/queue/processors/ImportNotesProcessorService.ts @@ -584,7 +584,8 @@ export class ImportNotesProcessorService { try { const date = new Date(tweet.created_at); - const textReplaceURLs = tweet.entities.urls && tweet.entities.urls.length > 0 ? await replaceTwitterUrls(tweet.full_text, tweet.entities.urls) : tweet.full_text; + const decodedText = tweet.full_text.replaceAll('>','>').replaceAll('<','<').replaceAll('&','&'); + const textReplaceURLs = tweet.entities.urls && tweet.entities.urls.length > 0 ? await replaceTwitterUrls(decodedText, tweet.entities.urls) : decodedText; const text = tweet.entities.user_mentions && tweet.entities.user_mentions.length > 0 ? await replaceTwitterMentions(textReplaceURLs, tweet.entities.user_mentions) : textReplaceURLs; const files: MiDriveFile[] = [];