mirror of
https://github.com/omnivore-app/omnivore.git
synced 2026-03-11 08:54:26 +00:00
fix parsing rss item link error because links can be an array of string too
This commit is contained in:
parent
aab8f459b3
commit
0ad562c46c
1 changed files with 7 additions and 7 deletions
|
|
@ -12,13 +12,8 @@ interface RssFeedRequest {
|
|||
lastFetchedAt: number // unix timestamp in milliseconds
|
||||
}
|
||||
|
||||
interface RssFeedItemLink {
|
||||
$: {
|
||||
rel?: string
|
||||
href: string
|
||||
type?: string
|
||||
}
|
||||
}
|
||||
// link can be a string or an object
|
||||
type RssFeedItemLink = string | { $: { rel?: string; href: string } }
|
||||
|
||||
function isRssFeedRequest(body: any): body is RssFeedRequest {
|
||||
return (
|
||||
|
|
@ -134,6 +129,11 @@ const getLink = (links: RssFeedItemLink[]) => {
|
|||
const sortedLinks: string[] = []
|
||||
|
||||
links.forEach((link) => {
|
||||
// if link is a string, it is the href
|
||||
if (typeof link === 'string') {
|
||||
return sortedLinks.push(link)
|
||||
}
|
||||
|
||||
if (link.$.rel === 'via') {
|
||||
sortedLinks[0] = link.$.href
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue