Skip to content

Commit

Permalink
clean up titles with certain unicode entities
Browse files Browse the repository at this point in the history
  • Loading branch information
mimecuvalo committed Apr 28, 2024
1 parent 7768480 commit aeda5eb
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion social-butterfly/feeds.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down

0 comments on commit aeda5eb

Please sign in to comment.