mirror of
https://github.com/thelittlerocket/rss-to-email.git
synced 2025-03-01 03:12:56 +08:00
Something in the paragraphs from daring fireball feed broke the output, build in a tiny tiny bit more secure parsing
This commit is contained in:
parent
22d628a661
commit
99e3795619
3 changed files with 3 additions and 3 deletions
|
@ -20,7 +20,7 @@ export default ({ content, href, paragraphStyle, blockquoteStyle }: Props) => {
|
|||
|
||||
return (
|
||||
<>
|
||||
<Text style={elements[0].localName === 'blockquote' ? blockquoteStyle : paragraphStyle}>{elements[0].text}</Text>
|
||||
<Text style={elements.at(0)?.localName === 'blockquote' ? blockquoteStyle : paragraphStyle}>{elements.at(0)?.text}</Text>
|
||||
{elements.length > 1 && (
|
||||
<Text style={paragraphStyle}>
|
||||
<Link href={href}>…</Link>
|
||||
|
|
|
@ -30,7 +30,7 @@ export default ({ content, href }: Props) => {
|
|||
const paragraphs = element.querySelectorAll('> p')
|
||||
return (
|
||||
<Fragment key="blockquote">
|
||||
<Text style={blockquote}>{paragraphs[0].text ?? ''}</Text>
|
||||
<Text style={blockquote}>{paragraphs.at(0)?.text ?? ''}</Text>
|
||||
{blockquoteHasMore && (
|
||||
<Text style={blockquote}>
|
||||
<Link style={link} href={href}>
|
||||
|
|
|
@ -16,5 +16,5 @@ export const parseLinks = (links: ItemLink[]) => {
|
|||
return `${links[0]}`
|
||||
}
|
||||
|
||||
return hrefByRel(links, 'related') ?? hrefByRel(links, 'alternate') ?? links[0].$.href
|
||||
return hrefByRel(links, 'related') ?? hrefByRel(links, 'alternate') ?? links.at(0)?.$.href
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue