Skip to content

Commit

Permalink
Embed - data filter updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
JasminDreasond committed Sep 11, 2024
1 parent c439116 commit 44a35a5
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions src/app/molecules/message/Embed.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -105,17 +105,23 @@ function Embed({ embed = {}, url = {}, roomId = null, threadId = null }) {
// Article
const articlePublisher =
typeof embed['article:publisher'] === 'string' && embed['article:publisher'].length > 0
? embed['article:publisher']
? embed['article:publisher'].trim()
: null;

const articleSection =
let articleSection =
embed['article:section'] === 'string' && embed['article:section'].length > 0
? embed['article:section']
? embed['article:section'].trim()
: null;

if (articleSection) {
while (articleSection.endsWith('\n') || articleSection.endsWith('\r')) {
articleSection = articleSection.substring(0, articleSection.length - 1);
}
}

const articleTag =
typeof embed['article:tag'] === 'string' && embed['article:tag'].length > 0
? embed['article:tag']
? embed['article:tag'].trim()
: null;

// Description
Expand All @@ -125,15 +131,15 @@ function Embed({ embed = {}, url = {}, roomId = null, threadId = null }) {
: null;

if (description) {
while (description.endsWith('\n')) {
while (description.endsWith('\n') || description.endsWith('\r')) {
description = description.substring(0, description.length - 1);
}
}

// Site Name
const siteName =
typeof embed['og:site_name'] === 'string' && embed['og:site_name'].length > 0
? embed['og:site_name']
? embed['og:site_name'].trim()
: null;

// Embed Type
Expand Down

0 comments on commit 44a35a5

Please sign in to comment.