Decode html entities in link embeds
This commit is contained in:
parent
88c868dd80
commit
57f2d1d59f
4 changed files with 12 additions and 7 deletions
|
@ -1,3 +1,4 @@
|
|||
import he from 'he'
|
||||
import {
|
||||
extractHtmlMeta,
|
||||
isBskyAppUrl,
|
||||
|
@ -59,8 +60,10 @@ export async function getLinkMeta(url: string): Promise<LinkMeta> {
|
|||
const httpRes = await fetch(url)
|
||||
const httpResBody = await httpRes.text()
|
||||
const httpResMeta = extractHtmlMeta(httpResBody)
|
||||
meta.title = httpResMeta.title
|
||||
meta.title = httpResMeta.title ? he.decode(httpResMeta.title) : undefined
|
||||
meta.description = httpResMeta.description
|
||||
? he.decode(httpResMeta.description)
|
||||
: undefined
|
||||
// TODO meta.image = httpResMeta.image
|
||||
} catch (e) {
|
||||
// failed
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue