diff options
author | 2024-03-19 21:24:30 -0700 | |
---|---|---|
committer | 2024-03-19 21:57:46 -0700 | |
commit | 08640b27d55f6382af6f08d0789b8109279ae825 (patch) | |
tree | e9b133e38bfb3d09b518d4b35a2292a06aaa661b /internal/reader/atom/atom_common.go | |
parent | 4be993e05537a2ed658f62060b6dd6b89304a346 (diff) | |
download | v2-08640b27d55f6382af6f08d0789b8109279ae825.tar.gz v2-08640b27d55f6382af6f08d0789b8109279ae825.tar.zst v2-08640b27d55f6382af6f08d0789b8109279ae825.zip |
Ensure enclosure URLs are always absolute
Diffstat (limited to 'internal/reader/atom/atom_common.go')
-rw-r--r-- | internal/reader/atom/atom_common.go | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/internal/reader/atom/atom_common.go b/internal/reader/atom/atom_common.go index debd46f1..945c5573 100644 --- a/internal/reader/atom/atom_common.go +++ b/internal/reader/atom/atom_common.go @@ -96,6 +96,21 @@ func (a AtomLinks) firstLinkWithRelationAndType(relation string, contentTypes .. return "" } +func (a AtomLinks) findAllLinksWithRelation(relation string) []*AtomLink { + var links []*AtomLink + + for _, link := range a { + if strings.EqualFold(link.Rel, relation) { + link.Href = strings.TrimSpace(link.Href) + if link.Href != "" { + links = append(links, link) + } + } + } + + return links +} + // The "atom:category" element conveys information about a category // associated with an entry or feed. This specification assigns no // meaning to the content (if any) of this element. |