diff options
author | sourque <contact@sourque.com> | 2021-11-27 01:17:17 -0800 |
---|---|---|
committer | Drew DeVault <sir@cmpwn.com> | 2021-11-27 10:19:58 +0100 |
commit | 28dc22a0ff77b5d961c11efddc50ff2b8cd663e2 (patch) | |
tree | 8e2388772aa9e781eaa349644570b074ba07aca6 | |
parent | e566294050776355ca0d3bfd7a1f6f70767cd08b (diff) |
Check for empty feed title1.0.0
For feeds with no title, openring places a link with no clickable
text on the byline ("via ..."). Instead, we replace the empty title
with a sensible substitute (URL.Host).
Additionally, fix an unhandled error.
-rw-r--r-- | openring.go | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/openring.go b/openring.go index e1865b8..aa74469 100644 --- a/openring.go +++ b/openring.go @@ -107,6 +107,10 @@ func main() { log.Printf("Error fetching %s: %s", source.String(), err.Error()) continue } + if feed.Title == "" { + log.Printf("Warning: feed from %s has no title", source.Host) + feed.Title = source.Host + } feeds = append(feeds, feed) log.Printf("Fetched %s", feed.Title) } @@ -142,7 +146,7 @@ func main() { summary := runewidth.Truncate( policy.Sanitize(raw_summary), *summaryLen, "…") - itemLink, _ := url.Parse(item.Link) + itemLink, err := url.Parse(item.Link) if err != nil { log.Fatal("failed parsing article URL of the feed item") } |