aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/feed.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2021-06-02 00:12:14 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2021-06-02 00:12:14 +0200
commitdc19440decf28afe245226108137f8e663d490be (patch)
tree76f68e1762bd850a308e8906be3143b50cda9afc /internal/feed/feed.go
parent376eee6450f1645762d62f68f7f642a9769f138d (diff)
downloadfeed2imap-go-dc19440decf28afe245226108137f8e663d490be.tar.gz
feed2imap-go-dc19440decf28afe245226108137f8e663d490be.tar.bz2
feed2imap-go-dc19440decf28afe245226108137f8e663d490be.zip
Do not try to download already embedded images
Diffstat (limited to '')
-rw-r--r--internal/feed/feed.go20
1 files changed, 20 insertions, 0 deletions
diff --git a/internal/feed/feed.go b/internal/feed/feed.go
index 431eae3..3b9aba1 100644
--- a/internal/feed/feed.go
+++ b/internal/feed/feed.go
@@ -2,6 +2,7 @@ package feed
import (
"fmt"
+ "net/url"
"strings"
"time"
@@ -134,3 +135,22 @@ func (feed *Feed) id() string {
}
return feed.extID.String()
}
+
+func (feed *Feed) url() *url.URL {
+ var feedUrl *url.URL
+ var err error
+
+ if feed.Url != "" {
+ feedUrl, err = url.Parse(feed.Url)
+ if err != nil {
+ panic(fmt.Sprintf("URL '%s' of feed '%s' is not a valid URL. How have we ended up here?", feed.Url, feed.Name))
+ }
+ } else if feed.feed.Link != "" {
+ feedUrl, err = url.Parse(feed.feed.Link)
+ if err != nil {
+ panic(fmt.Sprintf("Link '%s' of feed '%s' is not a valid URL.", feed.feed.Link, feed.Name))
+ }
+ }
+
+ return feedUrl
+}