From aeda5ebd2e5bbee445dbfde6111303b56635ca7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mime=20=C4=8Cuvalo?= Date: Sun, 28 Apr 2024 09:41:39 +0100 Subject: [PATCH] clean up titles with certain unicode entities --- social-butterfly/feeds.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/social-butterfly/feeds.ts b/social-butterfly/feeds.ts index 628776a..ac84473 100644 --- a/social-butterfly/feeds.ts +++ b/social-butterfly/feeds.ts @@ -187,6 +187,14 @@ async function handleEntry(feedEntry: FeedParser.Node, userRemote: UserRemote): const pocoPhotos = feedEntry['atom:author']?.['poco:photos']; const avatar = pocoPhotos && pocoPhotos['poco:value']['#']; + const title = (feedEntry.title || 'untitled') + .replace(/“/g, '“') + .replace(/”/g, '”') + .replace(/‘/g, '‘') + .replace(/’/g, '’') + .replace(/–/g, '–') + .replace(/—/g, '—'); + return { id: existingModelEntry?.id || undefined, avatar, @@ -200,7 +208,7 @@ async function handleEntry(feedEntry: FeedParser.Node, userRemote: UserRemote): link, postId: entryId, thread, - title: feedEntry.title || 'untitled', + title, toUsername: userRemote.localUsername, type: 'post', updatedAt: dateUpdated,